<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>class Time - RDoc Documentation</title>


<script src="./js/navigation.js" defer></script>
<script src="./js/search.js" defer></script>
<script src="./js/search_index.js" defer></script>
<script src="./js/searcher.js" defer></script>
<script src="./js/darkfish.js" defer></script>

<script src="./js/jquery-3.2.0.min.js"></script>

<script src="./js/vue.min.js"></script>
<script src="./js/js.cookie.min.js"></script>

<link href="./css/fonts.css" rel="stylesheet">
<link id='rdoccss' href="./css/rdoc.css" rel="stylesheet">
<link href="./css/carbon17.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "./";
  var index_rel_prefix = "./";
  var darkModeCsseHref = "./css/rdoc-dm.css"
  var defaultModeCssHref = "./css/rdoc.css"
  // var cssDarkmode = Cookies.get('darkmode');
  
  if( Cookies.get("darkmode") == "true") {
	$('#rdoccss').attr("href", darkModeCsseHref);
}

//  https://cssdeck.com/blog/simple-jquery-stylesheet-switcher/

document.write('<style type="text/css">body{display:none}</style>');

</script>


</head>
<body id="top" role="document" class="class">
  <!-- this is class.html -->

  <div id='actionbar' >
    <div class='wrapper mdiv'>
      <ul class='grids g0'></ul>
    </div> 
    <!-- VERSION HEADER for 3.3.0-preview2 NOT FOUND -->
  </div> <!-- end action bar -->

  <div class='wrapper hdiv'>

    


    <nav id='vapp' role="navigation">
    <div id="project-navigation">
      <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2><a href="./index.html" rel="home">Home</a></h2>

  <div id="table-of-contents-navigation"  >
    <a href="./table_of_contents.html#pages">Pages</a>
    <a href="./table_of_contents.html#classes">Classes</a>
    <a href="./table_of_contents.html#methods">Methods</a>
  </div>
</div>

      <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

    </div>


    
<div class="nav-section">
  <h3>Table of Contents</h3>

  <ul class="link-list" role="directory">
    <li><a href="#class-Time-label-Epoch+Seconds">Epoch Seconds</a>
    <li><a href="#class-Time-label-Time+Resolution">Time Resolution</a>
    <li><a href="#class-Time-label-Examples">Examples</a>
    <li><a href="#class-Time-label-Creating+a+New+Time+Instance">Creating a New Time Instance</a>
    <li><a href="#class-Time-label-Working+with+an+Instance+of+Time">Working with an Instance of Time</a>
    <li><a href="#class-Time-label-What-27s+Here">What’s Here</a>
    <li><a href="#class-Time-label-Methods+for+Creating">Methods for Creating</a>
    <li><a href="#class-Time-label-Methods+for+Fetching">Methods for Fetching</a>
    <li><a href="#class-Time-label-Methods+for+Querying">Methods for Querying</a>
    <li><a href="#class-Time-label-Methods+for+Comparing">Methods for Comparing</a>
    <li><a href="#class-Time-label-Methods+for+Converting">Methods for Converting</a>
    <li><a href="#class-Time-label-Methods+for+Rounding">Methods for Rounding</a>
  </ul>
</div>


    <button id='toggleThing' @click="toggleNav()" >Show/hide navigation</button>
    <div :class="isOpen ? 'block' : 'hidden' " id='toggleMe'>
      <div id="class-metadata">
        
        
<div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  <p class="link"><a href="Object.html">Object</a>
</div>

        
<div id="includes-section" class="nav-section">
  <h3>Included Modules</h3>

  <ul class="link-list">
    <li><a class="include" href="Comparable.html">Comparable</a>
  </ul>
</div>

        
        
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    <li ><a href="#method-c-at">::at</a>
    <li ><a href="#method-c-gm">::gm</a>
    <li ><a href="#method-c-local">::local</a>
    <li ><a href="#method-c-mktime">::mktime</a>
    <li ><a href="#method-c-new">::new</a>
    <li ><a href="#method-c-now">::now</a>
    <li ><a href="#method-c-utc">::utc</a>
    <li ><a href="#method-i-2B">#+</a>
    <li ><a href="#method-i-2D">#-</a>
    <li ><a href="#method-i-3C-3D-3E">#&lt;=&gt;</a>
    <li ><a href="#method-i-asctime">#asctime</a>
    <li ><a href="#method-i-ceil">#ceil</a>
    <li ><a href="#method-i-ctime">#ctime</a>
    <li ><a href="#method-i-day">#day</a>
    <li ><a href="#method-i-deconstruct_keys">#deconstruct_keys</a>
    <li ><a href="#method-i-dst-3F">#dst?</a>
    <li ><a href="#method-i-eql-3F">#eql?</a>
    <li ><a href="#method-i-floor">#floor</a>
    <li ><a href="#method-i-friday-3F">#friday?</a>
    <li ><a href="#method-i-getgm">#getgm</a>
    <li ><a href="#method-i-getlocal">#getlocal</a>
    <li ><a href="#method-i-getutc">#getutc</a>
    <li ><a href="#method-i-gmt-3F">#gmt?</a>
    <li ><a href="#method-i-gmt_offset">#gmt_offset</a>
    <li ><a href="#method-i-gmtime">#gmtime</a>
    <li ><a href="#method-i-gmtoff">#gmtoff</a>
    <li ><a href="#method-i-hash">#hash</a>
    <li ><a href="#method-i-hour">#hour</a>
    <li ><a href="#method-i-inspect">#inspect</a>
    <li ><a href="#method-i-isdst">#isdst</a>
    <li ><a href="#method-i-localtime">#localtime</a>
    <li ><a href="#method-i-mday">#mday</a>
    <li ><a href="#method-i-min">#min</a>
    <li ><a href="#method-i-mon">#mon</a>
    <li ><a href="#method-i-monday-3F">#monday?</a>
    <li ><a href="#method-i-month">#month</a>
    <li ><a href="#method-i-nsec">#nsec</a>
    <li ><a href="#method-i-round">#round</a>
    <li ><a href="#method-i-saturday-3F">#saturday?</a>
    <li ><a href="#method-i-sec">#sec</a>
    <li ><a href="#method-i-strftime">#strftime</a>
    <li ><a href="#method-i-subsec">#subsec</a>
    <li ><a href="#method-i-sunday-3F">#sunday?</a>
    <li ><a href="#method-i-thursday-3F">#thursday?</a>
    <li ><a href="#method-i-to_a">#to_a</a>
    <li ><a href="#method-i-to_f">#to_f</a>
    <li ><a href="#method-i-to_i">#to_i</a>
    <li ><a href="#method-i-to_r">#to_r</a>
    <li ><a href="#method-i-to_s">#to_s</a>
    <li ><a href="#method-i-tuesday-3F">#tuesday?</a>
    <li ><a href="#method-i-tv_nsec">#tv_nsec</a>
    <li ><a href="#method-i-tv_sec">#tv_sec</a>
    <li ><a href="#method-i-tv_usec">#tv_usec</a>
    <li ><a href="#method-i-usec">#usec</a>
    <li ><a href="#method-i-utc">#utc</a>
    <li ><a href="#method-i-utc-3F">#utc?</a>
    <li ><a href="#method-i-utc_offset">#utc_offset</a>
    <li ><a href="#method-i-wday">#wday</a>
    <li ><a href="#method-i-wednesday-3F">#wednesday?</a>
    <li ><a href="#method-i-yday">#yday</a>
    <li ><a href="#method-i-year">#year</a>
    <li ><a href="#method-i-zone">#zone</a>
  </ul>
</div>

      </div>
     </div>
    </nav>


    <div id='extraz'><div class='adzbox-index'  >
      
     </div>         
    </div>

    <main role="main" aria-labelledby="class-Time">
    <h1 id="class-Time" class="class">
      class Time
    </h1>

    <section class="description">
    
<p>A Time object represents a date and time:</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>) <span class="ruby-comment"># =&gt; 2000-01-01 00:00:00 -0600</span>
</pre>

<p>Although its value can be expressed as a single numeric (see <a href="Time.html#class-Time-label-Epoch+Seconds">Epoch Seconds</a> below), it can be convenient to deal with the value by parts:</p>

<pre class="ruby"><span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">-2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0.0</span>)
<span class="ruby-comment"># =&gt; -2000-01-01 00:00:00 -0600</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">year</span> <span class="ruby-comment"># =&gt; -2000</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">month</span> <span class="ruby-comment"># =&gt; 1</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">mday</span> <span class="ruby-comment"># =&gt; 1</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">hour</span> <span class="ruby-comment"># =&gt; 0</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">min</span> <span class="ruby-comment"># =&gt; 0</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">sec</span> <span class="ruby-comment"># =&gt; 0</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">subsec</span> <span class="ruby-comment"># =&gt; 0</span>

<span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">12</span>, <span class="ruby-value">31</span>, <span class="ruby-value">23</span>, <span class="ruby-value">59</span>, <span class="ruby-value">59.5</span>)
<span class="ruby-comment"># =&gt; 2000-12-31 23:59:59.5 -0600</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">year</span> <span class="ruby-comment"># =&gt; 2000</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">month</span> <span class="ruby-comment"># =&gt; 12</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">mday</span> <span class="ruby-comment"># =&gt; 31</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">hour</span> <span class="ruby-comment"># =&gt; 23</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">min</span> <span class="ruby-comment"># =&gt; 59</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">sec</span> <span class="ruby-comment"># =&gt; 59</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">subsec</span> <span class="ruby-comment"># =&gt; (1/2)</span>
</pre>

<h2 id="class-Time-label-Epoch+Seconds">Epoch Seconds<span><a href="#class-Time-label-Epoch+Seconds">&para;</a> <a href="#top">&uarr;</a></span></h2>

<p><em>Epoch seconds</em> is the exact number of seconds (including fractional subseconds) since the Unix Epoch, January 1, 1970.</p>

<p>You can retrieve that value exactly using method <a href="Time.html#method-i-to_r"><code>Time.to_r</code></a>:</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">at</span>(<span class="ruby-value">0</span>).<span class="ruby-identifier">to_r</span>        <span class="ruby-comment"># =&gt; (0/1)</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">at</span>(<span class="ruby-value">0.999999</span>).<span class="ruby-identifier">to_r</span> <span class="ruby-comment"># =&gt; (9007190247541737/9007199254740992)</span>
</pre>

<p>Other retrieval methods such as <a href="Time.html#method-i-to_i"><code>Time#to_i</code></a> and <a href="Time.html#method-i-to_f"><code>Time#to_f</code></a> may return a value that rounds or truncates subseconds.</p>

<h2 id="class-Time-label-Time+Resolution">Time Resolution<span><a href="#class-Time-label-Time+Resolution">&para;</a> <a href="#top">&uarr;</a></span></h2>

<p>A Time object derived from the system clock (for example, by method <a href="Time.html#method-c-now"><code>Time.now</code></a>) has the resolution supported by the system.</p>

<h2 id="class-Time-label-Examples">Examples<span><a href="#class-Time-label-Examples">&para;</a> <a href="#top">&uarr;</a></span></h2>

<p>All of these examples were done using the EST timezone which is GMT-5.</p>

<h3 id="class-Time-label-Creating+a+New+Time+Instance">Creating a New Time Instance<span><a href="#class-Time-label-Creating+a+New+Time+Instance">&para;</a> <a href="#top">&uarr;</a></span></h3>

<p>You can create a new instance of <a href="Time.html"><code>Time</code></a> with <a href="Time.html#method-c-new"><code>Time.new</code></a>. This will use the current system time. <a href="Time.html#method-c-now"><code>Time.now</code></a> is an alias for this. You can also pass parts of the time to <a href="Time.html#method-c-new"><code>Time.new</code></a> such as year, month, minute, etc. When you want to construct a time this way you must pass at least a year. If you pass the year with nothing else time will default to January 1 of that year at 00:00:00 with the current system timezone. Here are some examples:</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2002</span>)         <span class="ruby-comment">#=&gt; 2002-01-01 00:00:00 -0500</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2002</span>, <span class="ruby-value">10</span>)     <span class="ruby-comment">#=&gt; 2002-10-01 00:00:00 -0500</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2002</span>, <span class="ruby-value">10</span>, <span class="ruby-value">31</span>) <span class="ruby-comment">#=&gt; 2002-10-31 00:00:00 -0500</span>
</pre>

<p>You can pass a UTC offset:</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2002</span>, <span class="ruby-value">10</span>, <span class="ruby-value">31</span>, <span class="ruby-value">2</span>, <span class="ruby-value">2</span>, <span class="ruby-value">2</span>, <span class="ruby-string">&quot;+02:00&quot;</span>) <span class="ruby-comment">#=&gt; 2002-10-31 02:02:02 +0200</span>
</pre>

<p>Or a timezone object:</p>

<pre class="ruby"><span class="ruby-identifier">zone</span> = <span class="ruby-identifier">timezone</span>(<span class="ruby-string">&quot;Europe/Athens&quot;</span>)      <span class="ruby-comment"># Eastern European Time, UTC+2</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2002</span>, <span class="ruby-value">10</span>, <span class="ruby-value">31</span>, <span class="ruby-value">2</span>, <span class="ruby-value">2</span>, <span class="ruby-value">2</span>, <span class="ruby-identifier">zone</span>) <span class="ruby-comment">#=&gt; 2002-10-31 02:02:02 +0200</span>
</pre>

<p>You can also use <a href="Time.html#method-c-local"><code>Time.local</code></a> and <a href="Time.html#method-c-utc"><code>Time.utc</code></a> to infer local and UTC timezones instead of using the current system setting.</p>

<p>You can also create a new time using <a href="Time.html#method-c-at"><code>Time.at</code></a> which takes the number of seconds (with subsecond) since the <a href="https://en.wikipedia.org/wiki/Unix_time">Unix Epoch</a>.</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">at</span>(<span class="ruby-value">628232400</span>) <span class="ruby-comment">#=&gt; 1989-11-28 00:00:00 -0500</span>
</pre>

<h3 id="class-Time-label-Working+with+an+Instance+of+Time">Working with an Instance of Time<span><a href="#class-Time-label-Working+with+an+Instance+of+Time">&para;</a> <a href="#top">&uarr;</a></span></h3>

<p>Once you have an instance of <a href="Time.html"><code>Time</code></a> there is a multitude of things you can do with it. Below are some examples. For all of the following examples, we will work on the assumption that you have done the following:</p>

<pre class="ruby"><span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">1993</span>, <span class="ruby-value">02</span>, <span class="ruby-value">24</span>, <span class="ruby-value">12</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-string">&quot;+09:00&quot;</span>)
</pre>

<p>Was that a monday?</p>

<pre class="ruby"><span class="ruby-identifier">t</span>.<span class="ruby-identifier">monday?</span> <span class="ruby-comment">#=&gt; false</span>
</pre>

<p>What year was that again?</p>

<pre class="ruby"><span class="ruby-identifier">t</span>.<span class="ruby-identifier">year</span> <span class="ruby-comment">#=&gt; 1993</span>
</pre>

<p>Was it daylight savings at the time?</p>

<pre class="ruby"><span class="ruby-identifier">t</span>.<span class="ruby-identifier">dst?</span> <span class="ruby-comment">#=&gt; false</span>
</pre>

<p>What’s the day a year later?</p>

<pre class="ruby"><span class="ruby-identifier">t</span> <span class="ruby-operator">+</span> (<span class="ruby-value">60</span><span class="ruby-operator">*</span><span class="ruby-value">60</span><span class="ruby-operator">*</span><span class="ruby-value">24</span><span class="ruby-operator">*</span><span class="ruby-value">365</span>) <span class="ruby-comment">#=&gt; 1994-02-24 12:00:00 +0900</span>
</pre>

<p>How many seconds was that since the Unix Epoch?</p>

<pre class="ruby"><span class="ruby-identifier">t</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-comment">#=&gt; 730522800</span>
</pre>

<p>You can also do standard functions like compare two times.</p>

<pre class="ruby"><span class="ruby-identifier">t1</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2010</span>)
<span class="ruby-identifier">t2</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2011</span>)

<span class="ruby-identifier">t1</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">t2</span> <span class="ruby-comment">#=&gt; false</span>
<span class="ruby-identifier">t1</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">t1</span> <span class="ruby-comment">#=&gt; true</span>
<span class="ruby-identifier">t1</span> <span class="ruby-operator">&lt;</span>  <span class="ruby-identifier">t2</span> <span class="ruby-comment">#=&gt; true</span>
<span class="ruby-identifier">t1</span> <span class="ruby-operator">&gt;</span>  <span class="ruby-identifier">t2</span> <span class="ruby-comment">#=&gt; false</span>

<span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2010</span>,<span class="ruby-value">10</span>,<span class="ruby-value">31</span>).<span class="ruby-identifier">between?</span>(<span class="ruby-identifier">t1</span>, <span class="ruby-identifier">t2</span>) <span class="ruby-comment">#=&gt; true</span>
</pre>

<h2 id="class-Time-label-What-27s+Here">What’s Here<span><a href="#class-Time-label-What-27s+Here">&para;</a> <a href="#top">&uarr;</a></span></h2>

<p>First, what’s elsewhere. Class Time:</p>
<ul><li>
<p>Inherits from <a href="Object.html#class-Object-label-What-27s+Here">class Object</a>.</p>
</li><li>
<p>Includes <a href="Comparable.html#module-Comparable-label-What-27s+Here">module Comparable</a>.</p>
</li></ul>

<p>Here, class Time provides methods that are useful for:</p>
<ul><li>
<p><a href="Time.html#class-Time-label-Methods+for+Creating">Creating Time objects</a>.</p>
</li><li>
<p><a href="Time.html#class-Time-label-Methods+for+Fetching">Fetching Time values</a>.</p>
</li><li>
<p><a href="Time.html#class-Time-label-Methods+for+Querying">Querying a Time object</a>.</p>
</li><li>
<p><a href="Time.html#class-Time-label-Methods+for+Comparing">Comparing Time objects</a>.</p>
</li><li>
<p><a href="Time.html#class-Time-label-Methods+for+Converting">Converting a Time object</a>.</p>
</li><li>
<p><a href="Time.html#class-Time-label-Methods+for+Rounding">Rounding a Time</a>.</p>
</li></ul>

<h3 id="class-Time-label-Methods+for+Creating">Methods for Creating<span><a href="#class-Time-label-Methods+for+Creating">&para;</a> <a href="#top">&uarr;</a></span></h3>
<ul><li>
<p><a href="Time.html#method-c-new"><code>::new</code></a>: Returns a new time from specified arguments (year, month, etc.), including an optional timezone value.</p>
</li><li>
<p><a href="Time.html#method-c-local"><code>::local</code></a> (aliased as <a href="Time.html#method-c-mktime"><code>::mktime</code></a>): Same as <a href="Time.html#method-c-new"><code>::new</code></a>, except the timezone is the local timezone.</p>
</li><li>
<p><a href="Time.html#method-c-utc"><code>::utc</code></a> (aliased as <a href="Time.html#method-c-gm"><code>::gm</code></a>): Same as <a href="Time.html#method-c-new"><code>::new</code></a>, except the timezone is UTC.</p>
</li><li>
<p><a href="Time.html#method-c-at"><code>::at</code></a>: Returns a new time based on seconds since epoch.</p>
</li><li>
<p><a href="Time.html#method-c-now"><code>::now</code></a>: Returns a new time based on the current system time.</p>
</li><li>
<p><a href="Time.html#method-i-2B"><code>+</code></a> (plus): Returns a new time increased by the given number of seconds.</p>
</li><li>
<p><a href="Time.html#method-i-2D"><code>-</code></a> (minus): Returns a new time decreased by the given number of seconds.</p>
</li></ul>

<h3 id="class-Time-label-Methods+for+Fetching">Methods for Fetching<span><a href="#class-Time-label-Methods+for+Fetching">&para;</a> <a href="#top">&uarr;</a></span></h3>
<ul><li>
<p><a href="Time.html#method-i-year"><code>year</code></a>: Returns the year of the time.</p>
</li><li>
<p><a href="Time.html#method-i-month"><code>month</code></a> (aliased as <a href="Time.html#method-i-mon"><code>mon</code></a>): Returns the month of the time.</p>
</li><li>
<p><a href="Time.html#method-i-mday"><code>mday</code></a> (aliased as <a href="Time.html#method-i-day"><code>day</code></a>): Returns the day of the month.</p>
</li><li>
<p><a href="Time.html#method-i-hour"><code>hour</code></a>: Returns the hours value for the time.</p>
</li><li>
<p><a href="Time.html#method-i-min"><code>min</code></a>: Returns the minutes value for the time.</p>
</li><li>
<p><a href="Time.html#method-i-sec"><code>sec</code></a>: Returns the seconds value for the time.</p>
</li><li>
<p><a href="Time.html#method-i-usec"><code>usec</code></a> (aliased as <a href="Time.html#method-i-tv_usec"><code>tv_usec</code></a>): Returns the number of microseconds in the subseconds value of the time.</p>
</li><li>
<p><a href="Time.html#method-i-nsec"><code>nsec</code></a> (aliased as <a href="Time.html#method-i-tv_nsec"><code>tv_nsec</code></a>: Returns the number of nanoseconds in the subsecond part of the time.</p>
</li><li>
<p><a href="Time.html#method-i-subsec"><code>subsec</code></a>: Returns the subseconds value for the time.</p>
</li><li>
<p><a href="Time.html#method-i-wday"><code>wday</code></a>: Returns the integer weekday value of the time (0 == Sunday).</p>
</li><li>
<p><a href="Time.html#method-i-yday"><code>yday</code></a>: Returns the integer yearday value of the time (1 == January 1).</p>
</li><li>
<p><a href="Time.html#method-i-hash"><code>hash</code></a>: Returns the integer hash value for the time.</p>
</li><li>
<p><a href="Time.html#method-i-utc_offset"><code>utc_offset</code></a> (aliased as <a href="Time.html#method-i-gmt_offset"><code>gmt_offset</code></a> and <a href="Time.html#method-i-gmtoff"><code>gmtoff</code></a>): Returns the offset in seconds between time and UTC.</p>
</li><li>
<p><a href="Time.html#method-i-to_f"><code>to_f</code></a>: Returns the float number of seconds since epoch for the time.</p>
</li><li>
<p><a href="Time.html#method-i-to_i"><code>to_i</code></a> (aliased as <a href="Time.html#method-i-tv_sec"><code>tv_sec</code></a>): Returns the integer number of seconds since epoch for the time.</p>
</li><li>
<p><a href="Time.html#method-i-to_r"><code>to_r</code></a>: Returns the <a href="Rational.html"><code>Rational</code></a> number of seconds since epoch for the time.</p>
</li><li>
<p><a href="Time.html#method-i-zone"><code>zone</code></a>: Returns a string representation of the timezone of the time.</p>
</li></ul>

<h3 id="class-Time-label-Methods+for+Querying">Methods for Querying<span><a href="#class-Time-label-Methods+for+Querying">&para;</a> <a href="#top">&uarr;</a></span></h3>
<ul><li>
<p><a href="Time.html#method-i-utc-3F"><code>utc?</code></a> (aliased as <a href="Time.html#method-i-gmt-3F"><code>gmt?</code></a>): Returns whether the time is UTC.</p>
</li><li>
<p><a href="Time.html#method-i-dst-3F"><code>dst?</code></a> (aliased as <a href="Time.html#method-i-isdst"><code>isdst</code></a>): Returns whether the time is DST (daylight saving time).</p>
</li><li>
<p><a href="Time.html#method-i-sunday-3F"><code>sunday?</code></a>: Returns whether the time is a Sunday.</p>
</li><li>
<p><a href="Time.html#method-i-monday-3F"><code>monday?</code></a>: Returns whether the time is a Monday.</p>
</li><li>
<p><a href="Time.html#method-i-tuesday-3F"><code>tuesday?</code></a>: Returns whether the time is a Tuesday.</p>
</li><li>
<p><a href="Time.html#method-i-wednesday-3F"><code>wednesday?</code></a>: Returns whether the time is a Wednesday.</p>
</li><li>
<p><a href="Time.html#method-i-thursday-3F"><code>thursday?</code></a>: Returns whether the time is a Thursday.</p>
</li><li>
<p><a href="Time.html#method-i-friday-3F"><code>friday?</code></a>: Returns whether time is a Friday.</p>
</li><li>
<p><a href="Time.html#method-i-saturday-3F"><code>saturday?</code></a>: Returns whether the time is a Saturday.</p>
</li></ul>

<h3 id="class-Time-label-Methods+for+Comparing">Methods for Comparing<span><a href="#class-Time-label-Methods+for+Comparing">&para;</a> <a href="#top">&uarr;</a></span></h3>
<ul><li>
<p>#&lt;=&gt;: Compares <code>self</code> to another time.</p>
</li><li>
<p><a href="Time.html#method-i-eql-3F"><code>eql?</code></a>: Returns whether the time is equal to another time.</p>
</li></ul>

<h3 id="class-Time-label-Methods+for+Converting">Methods for Converting<span><a href="#class-Time-label-Methods+for+Converting">&para;</a> <a href="#top">&uarr;</a></span></h3>
<ul><li>
<p><a href="Time.html#method-i-asctime"><code>asctime</code></a> (aliased as <a href="Time.html#method-i-ctime"><code>ctime</code></a>): Returns the time as a string.</p>
</li><li>
<p><a href="Time.html#method-i-inspect"><code>inspect</code></a>: Returns the time in detail as a string.</p>
</li><li>
<p><a href="Time.html#method-i-strftime"><code>strftime</code></a>: Returns the time as a string, according to a given format.</p>
</li><li>
<p><a href="Time.html#method-i-to_a"><code>to_a</code></a>: Returns a 10-element array of values from the time.</p>
</li><li>
<p><a href="Time.html#method-i-to_s"><code>to_s</code></a>: Returns a string representation of the time.</p>
</li><li>
<p><a href="Time.html#method-i-getutc"><code>getutc</code></a> (aliased as <a href="Time.html#method-i-getgm"><code>getgm</code></a>): Returns a new time converted to UTC.</p>
</li><li>
<p><a href="Time.html#method-i-getlocal"><code>getlocal</code></a>: Returns a new time converted to local time.</p>
</li><li>
<p><a href="Time.html#method-i-utc"><code>utc</code></a> (aliased as <a href="Time.html#method-i-gmtime"><code>gmtime</code></a>): Converts time to UTC in place.</p>
</li><li>
<p><a href="Time.html#method-i-localtime"><code>localtime</code></a>: Converts time to local time in place.</p>
</li><li>
<p><a href="Time.html#method-i-deconstruct_keys"><code>deconstruct_keys</code></a>: Returns a hash of time components used in pattern-matching.</p>
</li></ul>

<h3 id="class-Time-label-Methods+for+Rounding">Methods for Rounding<span><a href="#class-Time-label-Methods+for+Rounding">&para;</a> <a href="#top">&uarr;</a></span></h3>
<ul><li>
<p><a href="Time.html#method-i-round"><code>round</code></a>:Returns a new time with subseconds rounded.</p>
</li><li>
<p><a href="Time.html#method-i-ceil"><code>ceil</code></a>: Returns a new time with subseconds raised to a ceiling.</p>
</li><li>
<p><a href="Time.html#method-i-floor"><code>floor</code></a>: Returns a new time with subseconds lowered to a floor.</p>
</li></ul>

<p>For the forms of argument <code>zone</code>, see <a href="timezones_rdoc.html">Timezone Specifiers</a>.</p>

    </section>

      <section id="5Buntitled-5D" class="documentation-section">





                <section id="public-class-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Class Methods</h3>
                </header>

                  <div id="method-c-at" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">at</span><span
                                class="method-args">(time, subsec = false, unit = :microsecond, in: nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns a new Time object based on the given arguments.</p>

<p>Required argument <code>time</code> may be either of:</p>
<ul><li>
<p>A Time object, whose value is the basis for the returned time; also influenced by optional keyword argument <code>in:</code> (see below).</p>
</li><li>
<p>A numeric number of <a href="Time.html#class-Time-label-Epoch+Seconds">Epoch seconds</a> for the returned time.</p>
</li></ul>

<p>Examples:</p>

<pre class="ruby"><span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">12</span>, <span class="ruby-value">31</span>, <span class="ruby-value">23</span>, <span class="ruby-value">59</span>, <span class="ruby-value">59</span>) <span class="ruby-comment"># =&gt; 2000-12-31 23:59:59 -0600</span>
<span class="ruby-identifier">secs</span> = <span class="ruby-identifier">t</span>.<span class="ruby-identifier">to_i</span>                          <span class="ruby-comment"># =&gt; 978328799</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">at</span>(<span class="ruby-identifier">secs</span>)                          <span class="ruby-comment"># =&gt; 2000-12-31 23:59:59 -0600</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">at</span>(<span class="ruby-identifier">secs</span> <span class="ruby-operator">+</span> <span class="ruby-value">0.5</span>)                    <span class="ruby-comment"># =&gt; 2000-12-31 23:59:59.5 -0600</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">at</span>(<span class="ruby-value">1000000000</span>)                    <span class="ruby-comment"># =&gt; 2001-09-08 20:46:40 -0500</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">at</span>(<span class="ruby-value">0</span>)                             <span class="ruby-comment"># =&gt; 1969-12-31 18:00:00 -0600</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">at</span>(<span class="ruby-value">-1000000000</span>)                   <span class="ruby-comment"># =&gt; 1938-04-24 17:13:20 -0500</span>
</pre>

<p>Optional numeric argument <code>subsec</code> and optional symbol argument <code>units</code> work together to specify subseconds for the returned time; argument <code>units</code> specifies the units for <code>subsec</code>:</p>
<ul><li>
<p><code>:millisecond</code>: <code>subsec</code> in milliseconds:</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">at</span>(<span class="ruby-identifier">secs</span>, <span class="ruby-value">0</span>, <span class="ruby-value">:millisecond</span>)     <span class="ruby-comment"># =&gt; 2000-12-31 23:59:59 -0600</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">at</span>(<span class="ruby-identifier">secs</span>, <span class="ruby-value">500</span>, <span class="ruby-value">:millisecond</span>)   <span class="ruby-comment"># =&gt; 2000-12-31 23:59:59.5 -0600</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">at</span>(<span class="ruby-identifier">secs</span>, <span class="ruby-value">1000</span>, <span class="ruby-value">:millisecond</span>)  <span class="ruby-comment"># =&gt; 2001-01-01 00:00:00 -0600</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">at</span>(<span class="ruby-identifier">secs</span>, <span class="ruby-value">-1000</span>, <span class="ruby-value">:millisecond</span>) <span class="ruby-comment"># =&gt; 2000-12-31 23:59:58 -0600</span>
</pre>
</li><li>
<p><code>:microsecond</code> or <code>:usec</code>: <code>subsec</code> in microseconds:</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">at</span>(<span class="ruby-identifier">secs</span>, <span class="ruby-value">0</span>, <span class="ruby-value">:microsecond</span>)        <span class="ruby-comment"># =&gt; 2000-12-31 23:59:59 -0600</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">at</span>(<span class="ruby-identifier">secs</span>, <span class="ruby-value">500000</span>, <span class="ruby-value">:microsecond</span>)   <span class="ruby-comment"># =&gt; 2000-12-31 23:59:59.5 -0600</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">at</span>(<span class="ruby-identifier">secs</span>, <span class="ruby-value">1000000</span>, <span class="ruby-value">:microsecond</span>)  <span class="ruby-comment"># =&gt; 2001-01-01 00:00:00 -0600</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">at</span>(<span class="ruby-identifier">secs</span>, <span class="ruby-value">-1000000</span>, <span class="ruby-value">:microsecond</span>) <span class="ruby-comment"># =&gt; 2000-12-31 23:59:58 -0600</span>
</pre>
</li><li>
<p><code>:nanosecond</code> or <code>:nsec</code>: <code>subsec</code> in nanoseconds:</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">at</span>(<span class="ruby-identifier">secs</span>, <span class="ruby-value">0</span>, <span class="ruby-value">:nanosecond</span>)           <span class="ruby-comment"># =&gt; 2000-12-31 23:59:59 -0600</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">at</span>(<span class="ruby-identifier">secs</span>, <span class="ruby-value">500000000</span>, <span class="ruby-value">:nanosecond</span>)   <span class="ruby-comment"># =&gt; 2000-12-31 23:59:59.5 -0600</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">at</span>(<span class="ruby-identifier">secs</span>, <span class="ruby-value">1000000000</span>, <span class="ruby-value">:nanosecond</span>)  <span class="ruby-comment"># =&gt; 2001-01-01 00:00:00 -0600</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">at</span>(<span class="ruby-identifier">secs</span>, <span class="ruby-value">-1000000000</span>, <span class="ruby-value">:nanosecond</span>) <span class="ruby-comment"># =&gt; 2000-12-31 23:59:58 -0600</span>
</pre>
</li></ul>

<p>Optional keyword argument <code>+in: zone</code> specifies the timezone for the returned time:</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">at</span>(<span class="ruby-identifier">secs</span>, <span class="ruby-value">in:</span> <span class="ruby-string">&#39;+12:00&#39;</span>) <span class="ruby-comment"># =&gt; 2001-01-01 17:59:59 +1200</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">at</span>(<span class="ruby-identifier">secs</span>, <span class="ruby-value">in:</span> <span class="ruby-string">&#39;-12:00&#39;</span>) <span class="ruby-comment"># =&gt; 2000-12-31 17:59:59 -1200</span>
</pre>

<p>For the forms of argument <code>zone</code>, see <a href="timezones_rdoc.html">Timezone Specifiers</a>.</p>

                              <div class="method-source-code" id="at-source">
            <pre><span class="ruby-comment"># File ruby_3_3_0_preview2/timev.rb, line 282</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">at</span>(<span class="ruby-identifier">time</span>, <span class="ruby-identifier">subsec</span> = <span class="ruby-keyword">false</span>, <span class="ruby-identifier">unit</span> = <span class="ruby-value">:microsecond</span>, <span class="ruby-value">in:</span> <span class="ruby-keyword">nil</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-constant">Primitive</span>.<span class="ruby-identifier">mandatory_only?</span>
    <span class="ruby-constant">Primitive</span>.<span class="ruby-identifier">time_s_at1</span>(<span class="ruby-identifier">time</span>)
  <span class="ruby-keyword">else</span>
    <span class="ruby-constant">Primitive</span>.<span class="ruby-identifier">time_s_at</span>(<span class="ruby-identifier">time</span>, <span class="ruby-identifier">subsec</span>, <span class="ruby-identifier">unit</span>, <span class="ruby-constant">Primitive</span>.<span class="ruby-identifier">arg!</span>(<span class="ruby-value">:in</span>))
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-gm" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">gm</span><span
                                class="method-args">(*args)</span>
                            </div>

                            <div class="method-description">
                              <p>Returns a new Time object based the on given arguments, in the UTC timezone.</p>

<p>With one to seven arguments given, the arguments are interpreted as in the first calling sequence above:</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span> = <span class="ruby-value">1</span>, <span class="ruby-identifier">mday</span> = <span class="ruby-value">1</span>, <span class="ruby-identifier">hour</span> = <span class="ruby-value">0</span>, <span class="ruby-identifier">min</span> = <span class="ruby-value">0</span>, <span class="ruby-identifier">sec</span> = <span class="ruby-value">0</span>, <span class="ruby-identifier">usec</span> = <span class="ruby-value">0</span>)
</pre>

<p>Examples:</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>)  <span class="ruby-comment"># =&gt; 2000-01-01 00:00:00 UTC</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">-2000</span>) <span class="ruby-comment"># =&gt; -2000-01-01 00:00:00 UTC</span>
</pre>

<p>There are no minimum and maximum values for the required argument <code>year</code>.</p>

<p>For the optional arguments:</p>
<ul><li>
<p><code>month</code>: Month in range (1..12), or case-insensitive 3-letter month name:</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>)     <span class="ruby-comment"># =&gt; 2000-01-01 00:00:00 UTC</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">12</span>)    <span class="ruby-comment"># =&gt; 2000-12-01 00:00:00 UTC</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>, <span class="ruby-string">&#39;jan&#39;</span>) <span class="ruby-comment"># =&gt; 2000-01-01 00:00:00 UTC</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>, <span class="ruby-string">&#39;JAN&#39;</span>) <span class="ruby-comment"># =&gt; 2000-01-01 00:00:00 UTC</span>
</pre>
</li><li>
<p><code>mday</code>: Month day in range(1..31):</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>)  <span class="ruby-comment"># =&gt; 2000-01-01 00:00:00 UTC</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">31</span>) <span class="ruby-comment"># =&gt; 2000-01-31 00:00:00 UTC</span>
</pre>
</li><li>
<p><code>hour</code>: Hour in range (0..23), or 24 if <code>min</code>, <code>sec</code>, and <code>usec</code> are zero:</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">0</span>)  <span class="ruby-comment"># =&gt; 2000-01-01 00:00:00 UTC</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">23</span>) <span class="ruby-comment"># =&gt; 2000-01-01 23:00:00 UTC</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">24</span>) <span class="ruby-comment"># =&gt; 2000-01-02 00:00:00 UTC</span>
</pre>
</li><li>
<p><code>min</code>: Minute in range (0..59):</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>)  <span class="ruby-comment"># =&gt; 2000-01-01 00:00:00 UTC</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">0</span>, <span class="ruby-value">59</span>) <span class="ruby-comment"># =&gt; 2000-01-01 00:59:00 UTC</span>
</pre>
</li><li>
<p><code>sec</code>: Second in range (0..59), or 60 if <code>usec</code> is zero:</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>)  <span class="ruby-comment"># =&gt; 2000-01-01 00:00:00 UTC</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">59</span>) <span class="ruby-comment"># =&gt; 2000-01-01 00:00:59 UTC</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">60</span>) <span class="ruby-comment"># =&gt; 2000-01-01 00:01:00 UTC</span>
</pre>
</li><li>
<p><code>usec</code>: Microsecond in range (0..999999):</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>)      <span class="ruby-comment"># =&gt; 2000-01-01 00:00:00 UTC</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">999999</span>) <span class="ruby-comment"># =&gt; 2000-01-01 00:00:00.999999 UTC</span>
</pre>
</li></ul>

<p>The values may be:</p>
<ul><li>
<p>Integers, as above.</p>
</li><li>
<p>Numerics convertible to integers:</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-constant">Float</span>(<span class="ruby-value">0.0</span>), <span class="ruby-constant">Rational</span>(<span class="ruby-value">1</span>, <span class="ruby-value">1</span>), <span class="ruby-value">1.0</span>, <span class="ruby-value">0.0</span>, <span class="ruby-value">0.0</span>, <span class="ruby-value">0.0</span>, <span class="ruby-value">0.0</span>)
<span class="ruby-comment"># =&gt; 0000-01-01 00:00:00 UTC</span>
</pre>
</li><li>
<p><a href="String.html"><code>String</code></a> integers:</p>

<pre class="ruby"><span class="ruby-identifier">a</span> = <span class="ruby-node">%w[0 1 1 0 0 0 0 0]</span>
<span class="ruby-comment"># =&gt; [&quot;0&quot;, &quot;1&quot;, &quot;1&quot;, &quot;0&quot;, &quot;0&quot;, &quot;0&quot;, &quot;0&quot;, &quot;0&quot;]</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">a</span>) <span class="ruby-comment"># =&gt; 0000-01-01 00:00:00 UTC</span>
</pre>
</li></ul>

<p>When exactly ten arguments are given, the arguments are interpreted as in the second calling sequence above:</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-identifier">sec</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">mday</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">year</span>, <span class="ruby-identifier">dummy</span>, <span class="ruby-identifier">dummy</span>, <span class="ruby-identifier">dummy</span>, <span class="ruby-identifier">dummy</span>)
</pre>

<p>where the <code>dummy</code> arguments are ignored:</p>

<pre class="ruby"><span class="ruby-identifier">a</span> = [<span class="ruby-value">0</span>, <span class="ruby-value">1</span>, <span class="ruby-value">2</span>, <span class="ruby-value">3</span>, <span class="ruby-value">4</span>, <span class="ruby-value">5</span>, <span class="ruby-value">6</span>, <span class="ruby-value">7</span>, <span class="ruby-value">8</span>, <span class="ruby-value">9</span>]
<span class="ruby-comment"># =&gt; [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">a</span>) <span class="ruby-comment"># =&gt; 0005-04-03 02:01:00 UTC</span>
</pre>

<p>This form is useful for creating a Time object from a 10-element array returned by <a href="Time.html#method-i-to_a"><code>Time.to_a</code></a>:</p>

<pre class="ruby"><span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">2</span>, <span class="ruby-value">3</span>, <span class="ruby-value">4</span>, <span class="ruby-value">5</span>, <span class="ruby-value">6</span>) <span class="ruby-comment"># =&gt; 2000-01-02 03:04:05 +000006</span>
<span class="ruby-identifier">a</span> = <span class="ruby-identifier">t</span>.<span class="ruby-identifier">to_a</span>   <span class="ruby-comment"># =&gt; [5, 4, 3, 2, 1, 2000, 0, 2, false, nil]</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">a</span>) <span class="ruby-comment"># =&gt; 2000-01-02 03:04:05 UTC</span>
</pre>

<p>The two forms have their first six arguments in common, though in different orders; the ranges of these common arguments are the same for both forms; see above.</p>

<p>Raises an exception if the number of arguments is eight, nine, or greater than ten.</p>

<p>Related: <a href="Time.html#method-c-local"><code>Time.local</code></a>.</p>

                            </div>


                            <div class="aliases">
                              Alias for: <a href="Time.html#method-c-utc">utc</a>
                            </div>
                          </div>

                  <div id="method-c-local" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          local(year, month = 1, mday = 1, hour = 0, min = 0, sec = 0, usec = 0) &rarr; new_time
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>
                      <div class="method-heading">
                        <span class="method-callseq">
                          local(sec, min, hour, mday, month, year, dummy, dummy, dummy, dummy) &rarr; new_time
                              </span>
                            </div>

                            <div class="method-description">
                              <p>Like <a href="Time.html#method-c-utc"><code>Time.utc</code></a>, except that the returned Time object has the local timezone, not the UTC timezone:</p>

<pre class="ruby"><span class="ruby-comment"># With seven arguments.</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">local</span>(<span class="ruby-value">0</span>, <span class="ruby-value">1</span>, <span class="ruby-value">2</span>, <span class="ruby-value">3</span>, <span class="ruby-value">4</span>, <span class="ruby-value">5</span>, <span class="ruby-value">6</span>)
<span class="ruby-comment"># =&gt; 0000-01-02 03:04:05.000006 -0600</span>
<span class="ruby-comment"># With exactly ten arguments.</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">local</span>(<span class="ruby-value">0</span>, <span class="ruby-value">1</span>, <span class="ruby-value">2</span>, <span class="ruby-value">3</span>, <span class="ruby-value">4</span>, <span class="ruby-value">5</span>, <span class="ruby-value">6</span>, <span class="ruby-value">7</span>, <span class="ruby-value">8</span>, <span class="ruby-value">9</span>)
<span class="ruby-comment"># =&gt; 0005-04-03 02:01:00 -0600</span>
</pre>

                              <div class="method-source-code" id="local-source">
            <pre>static VALUE
time_s_mktime(int argc, VALUE *argv, VALUE klass)
{
    struct vtm vtm;

    time_arg(argc, argv, &amp;vtm);
    return time_localtime(time_new_timew(klass, timelocalw(&amp;vtm)));
}</pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="Time.html#method-c-mktime">mktime</a>
                            </div>

                          </div>

                  <div id="method-c-mktime" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">mktime</span><span
                                class="method-args">(*args)</span>
                            </div>

                            <div class="method-description">
                              <p>Like <a href="Time.html#method-c-utc"><code>Time.utc</code></a>, except that the returned Time object has the local timezone, not the UTC timezone:</p>

<pre class="ruby"><span class="ruby-comment"># With seven arguments.</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">local</span>(<span class="ruby-value">0</span>, <span class="ruby-value">1</span>, <span class="ruby-value">2</span>, <span class="ruby-value">3</span>, <span class="ruby-value">4</span>, <span class="ruby-value">5</span>, <span class="ruby-value">6</span>)
<span class="ruby-comment"># =&gt; 0000-01-02 03:04:05.000006 -0600</span>
<span class="ruby-comment"># With exactly ten arguments.</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">local</span>(<span class="ruby-value">0</span>, <span class="ruby-value">1</span>, <span class="ruby-value">2</span>, <span class="ruby-value">3</span>, <span class="ruby-value">4</span>, <span class="ruby-value">5</span>, <span class="ruby-value">6</span>, <span class="ruby-value">7</span>, <span class="ruby-value">8</span>, <span class="ruby-value">9</span>)
<span class="ruby-comment"># =&gt; 0005-04-03 02:01:00 -0600</span>
</pre>

                            </div>


                            <div class="aliases">
                              Alias for: <a href="Time.html#method-c-local">local</a>
                            </div>
                          </div>

                  <div id="method-c-new" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">new</span><span
                                class="method-args">(year = (now = true), mon = (str = year; nil), mday = nil, hour = nil, min = nil, sec = nil, zone = nil, in: nil, precision: 9)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns a new Time object based on the given arguments, by default in the local timezone.</p>

<p>With no positional arguments, returns the value of <a href="Time.html#method-c-now"><code>Time.now</code></a>:</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span> <span class="ruby-comment"># =&gt; 2021-04-24 17:27:46.0512465 -0500</span>
</pre>

<p>With one string argument that represents a time, returns a new Time object based on the given argument, in the local timezone.</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&#39;2000-12-31 23:59:59.5&#39;</span>)              <span class="ruby-comment"># =&gt; 2000-12-31 23:59:59.5 -0600</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&#39;2000-12-31 23:59:59.5 +0900&#39;</span>)        <span class="ruby-comment"># =&gt; 2000-12-31 23:59:59.5 +0900</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&#39;2000-12-31 23:59:59.5&#39;</span>, <span class="ruby-value">in:</span> <span class="ruby-string">&#39;+0900&#39;</span>) <span class="ruby-comment"># =&gt; 2000-12-31 23:59:59.5 +0900</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&#39;2000-12-31 23:59:59.5&#39;</span>)              <span class="ruby-comment"># =&gt; 2000-12-31 23:59:59.5 -0600</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&#39;2000-12-31 23:59:59.56789&#39;</span>, <span class="ruby-value">precision:</span> <span class="ruby-value">3</span>) <span class="ruby-comment"># =&gt; 2000-12-31 23:59:59.567 -0600</span>
</pre>

<p>With one to six arguments, returns a new Time object based on the given arguments, in the local timezone.</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">2</span>, <span class="ruby-value">3</span>, <span class="ruby-value">4</span>, <span class="ruby-value">5</span>) <span class="ruby-comment"># =&gt; 2000-01-02 03:04:05 -0600</span>
</pre>

<p>For the positional arguments (other than <code>zone</code>):</p>
<ul><li>
<p><code>year</code>: Year, with no range limits:</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">999999999</span>)  <span class="ruby-comment"># =&gt; 999999999-01-01 00:00:00 -0600</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">-999999999</span>) <span class="ruby-comment"># =&gt; -999999999-01-01 00:00:00 -0600</span>
</pre>
</li><li>
<p><code>month</code>: Month in range (1..12), or case-insensitive 3-letter month name:</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>)     <span class="ruby-comment"># =&gt; 2000-01-01 00:00:00 -0600</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">12</span>)    <span class="ruby-comment"># =&gt; 2000-12-01 00:00:00 -0600</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>, <span class="ruby-string">&#39;jan&#39;</span>) <span class="ruby-comment"># =&gt; 2000-01-01 00:00:00 -0600</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>, <span class="ruby-string">&#39;JAN&#39;</span>) <span class="ruby-comment"># =&gt; 2000-01-01 00:00:00 -0600</span>
</pre>
</li><li>
<p><code>mday</code>: Month day in range(1..31):</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>)  <span class="ruby-comment"># =&gt; 2000-01-01 00:00:00 -0600</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">31</span>) <span class="ruby-comment"># =&gt; 2000-01-31 00:00:00 -0600</span>
</pre>
</li><li>
<p><code>hour</code>: Hour in range (0..23), or 24 if <code>min</code>, <code>sec</code>, and <code>usec</code> are zero:</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">0</span>)  <span class="ruby-comment"># =&gt; 2000-01-01 00:00:00 -0600</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">23</span>) <span class="ruby-comment"># =&gt; 2000-01-01 23:00:00 -0600</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">24</span>) <span class="ruby-comment"># =&gt; 2000-01-02 00:00:00 -0600</span>
</pre>
</li><li>
<p><code>min</code>: Minute in range (0..59):</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>)  <span class="ruby-comment"># =&gt; 2000-01-01 00:00:00 -0600</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">0</span>, <span class="ruby-value">59</span>) <span class="ruby-comment"># =&gt; 2000-01-01 00:59:00 -0600</span>
</pre>
</li><li>
<p><code>sec</code>: Second in range (0…61):</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>)  <span class="ruby-comment"># =&gt; 2000-01-01 00:00:00 -0600</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">59</span>) <span class="ruby-comment"># =&gt; 2000-01-01 00:00:59 -0600</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">60</span>) <span class="ruby-comment"># =&gt; 2000-01-01 00:01:00 -0600</span>
</pre>

<p><code>sec</code> may be <a href="Float.html"><code>Float</code></a> or <a href="Rational.html"><code>Rational</code></a>.</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">59.5</span>)  <span class="ruby-comment"># =&gt; 2000-12-31 23:59:59.5 +0900</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">59.7r</span>) <span class="ruby-comment"># =&gt; 2000-12-31 23:59:59.7 +0900</span>
</pre>
</li></ul>

<p>These values may be:</p>
<ul><li>
<p>Integers, as above.</p>
</li><li>
<p>Numerics convertible to integers:</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Float</span>(<span class="ruby-value">0.0</span>), <span class="ruby-constant">Rational</span>(<span class="ruby-value">1</span>, <span class="ruby-value">1</span>), <span class="ruby-value">1.0</span>, <span class="ruby-value">0.0</span>, <span class="ruby-value">0.0</span>, <span class="ruby-value">0.0</span>)
<span class="ruby-comment"># =&gt; 0000-01-01 00:00:00 -0600</span>
</pre>
</li><li>
<p><a href="String.html"><code>String</code></a> integers:</p>

<pre class="ruby"><span class="ruby-identifier">a</span> = <span class="ruby-node">%w[0 1 1 0 0 0]</span>
<span class="ruby-comment"># =&gt; [&quot;0&quot;, &quot;1&quot;, &quot;1&quot;, &quot;0&quot;, &quot;0&quot;, &quot;0&quot;]</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">a</span>) <span class="ruby-comment"># =&gt; 0000-01-01 00:00:00 -0600</span>
</pre>
</li></ul>

<p>When positional argument <code>zone</code> or keyword argument <code>in:</code> is given, the new Time object is in the specified timezone. For the forms of argument <code>zone</code>, see <a href="timezones_rdoc.html">Timezone Specifiers</a>:</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-string">&#39;+12:00&#39;</span>)
<span class="ruby-comment"># =&gt; 2000-01-01 00:00:00 +1200</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">in:</span> <span class="ruby-string">&#39;-12:00&#39;</span>)
<span class="ruby-comment"># =&gt; 2000-01-01 00:00:00 -1200</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">in:</span> <span class="ruby-string">&#39;-12:00&#39;</span>)
<span class="ruby-comment"># =&gt; 2022-08-23 08:49:26.1941467 -1200</span>
</pre>
<ul><li>
<p><code>precision</code>: maximum effective digits in sub-second part, default is 9. More digits will be truncated, as other operations of Time. Ignored unless the first argument is a string.</p>
</li></ul>

                              <div class="method-source-code" id="new-source">
            <pre><span class="ruby-comment"># File ruby_3_3_0_preview2/timev.rb, line 384</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">year</span> = (<span class="ruby-identifier">now</span> = <span class="ruby-keyword">true</span>), <span class="ruby-identifier">mon</span> = (<span class="ruby-identifier">str</span> = <span class="ruby-identifier">year</span>; <span class="ruby-keyword">nil</span>), <span class="ruby-identifier">mday</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-identifier">hour</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-identifier">min</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-identifier">sec</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-identifier">zone</span> = <span class="ruby-keyword">nil</span>,
               <span class="ruby-value">in:</span> <span class="ruby-keyword">nil</span>, <span class="ruby-value">precision:</span> <span class="ruby-value">9</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">zone</span>
    <span class="ruby-keyword">if</span> <span class="ruby-constant">Primitive</span>.<span class="ruby-identifier">arg!</span>(<span class="ruby-value">:in</span>)
      <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-string">&quot;timezone argument given as positional and keyword arguments&quot;</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">zone</span> = <span class="ruby-constant">Primitive</span>.<span class="ruby-identifier">arg!</span>(<span class="ruby-value">:in</span>)
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">now</span>
    <span class="ruby-keyword">return</span> <span class="ruby-constant">Primitive</span>.<span class="ruby-identifier">time_init_now</span>(<span class="ruby-identifier">zone</span>)
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">str</span> <span class="ruby-keyword">and</span> <span class="ruby-constant">Primitive</span>.<span class="ruby-identifier">time_init_parse</span>(<span class="ruby-identifier">str</span>, <span class="ruby-identifier">zone</span>, <span class="ruby-identifier">precision</span>)
    <span class="ruby-keyword">return</span> <span class="ruby-keyword">self</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-constant">Primitive</span>.<span class="ruby-identifier">time_init_args</span>(<span class="ruby-identifier">year</span>, <span class="ruby-identifier">mon</span>, <span class="ruby-identifier">mday</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>, <span class="ruby-identifier">zone</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-now" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">now</span><span
                                class="method-args">(in: nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Creates a new Time object from the current system time. This is the same as <a href="Time.html#method-c-new"><code>Time.new</code></a> without arguments.</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>               <span class="ruby-comment"># =&gt; 2009-06-24 12:39:54 +0900</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>(<span class="ruby-value">in:</span> <span class="ruby-string">&#39;+04:00&#39;</span>) <span class="ruby-comment"># =&gt; 2009-06-24 07:39:54 +0400</span>
</pre>

<p>For forms of argument <code>zone</code>, see <a href="timezones_rdoc.html">Timezone Specifiers</a>.</p>

                              <div class="method-source-code" id="now-source">
            <pre><span class="ruby-comment"># File ruby_3_3_0_preview2/timev.rb, line 223</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">now</span>(<span class="ruby-value">in:</span> <span class="ruby-keyword">nil</span>)
  <span class="ruby-constant">Primitive</span>.<span class="ruby-identifier">time_s_now</span>(<span class="ruby-constant">Primitive</span>.<span class="ruby-identifier">arg!</span>(<span class="ruby-value">:in</span>))
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-utc" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          utc(year, month = 1, mday = 1, hour = 0, min = 0, sec = 0, usec = 0) &rarr; new_time
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>
                      <div class="method-heading">
                        <span class="method-callseq">
                          utc(sec, min, hour, mday, month, year, dummy, dummy, dummy, dummy) &rarr; new_time
                              </span>
                            </div>

                            <div class="method-description">
                              <p>Returns a new Time object based the on given arguments, in the UTC timezone.</p>

<p>With one to seven arguments given, the arguments are interpreted as in the first calling sequence above:</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span> = <span class="ruby-value">1</span>, <span class="ruby-identifier">mday</span> = <span class="ruby-value">1</span>, <span class="ruby-identifier">hour</span> = <span class="ruby-value">0</span>, <span class="ruby-identifier">min</span> = <span class="ruby-value">0</span>, <span class="ruby-identifier">sec</span> = <span class="ruby-value">0</span>, <span class="ruby-identifier">usec</span> = <span class="ruby-value">0</span>)
</pre>

<p>Examples:</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>)  <span class="ruby-comment"># =&gt; 2000-01-01 00:00:00 UTC</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">-2000</span>) <span class="ruby-comment"># =&gt; -2000-01-01 00:00:00 UTC</span>
</pre>

<p>There are no minimum and maximum values for the required argument <code>year</code>.</p>

<p>For the optional arguments:</p>
<ul><li>
<p><code>month</code>: Month in range (1..12), or case-insensitive 3-letter month name:</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>)     <span class="ruby-comment"># =&gt; 2000-01-01 00:00:00 UTC</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">12</span>)    <span class="ruby-comment"># =&gt; 2000-12-01 00:00:00 UTC</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>, <span class="ruby-string">&#39;jan&#39;</span>) <span class="ruby-comment"># =&gt; 2000-01-01 00:00:00 UTC</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>, <span class="ruby-string">&#39;JAN&#39;</span>) <span class="ruby-comment"># =&gt; 2000-01-01 00:00:00 UTC</span>
</pre>
</li><li>
<p><code>mday</code>: Month day in range(1..31):</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>)  <span class="ruby-comment"># =&gt; 2000-01-01 00:00:00 UTC</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">31</span>) <span class="ruby-comment"># =&gt; 2000-01-31 00:00:00 UTC</span>
</pre>
</li><li>
<p><code>hour</code>: Hour in range (0..23), or 24 if <code>min</code>, <code>sec</code>, and <code>usec</code> are zero:</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">0</span>)  <span class="ruby-comment"># =&gt; 2000-01-01 00:00:00 UTC</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">23</span>) <span class="ruby-comment"># =&gt; 2000-01-01 23:00:00 UTC</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">24</span>) <span class="ruby-comment"># =&gt; 2000-01-02 00:00:00 UTC</span>
</pre>
</li><li>
<p><code>min</code>: Minute in range (0..59):</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>)  <span class="ruby-comment"># =&gt; 2000-01-01 00:00:00 UTC</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">0</span>, <span class="ruby-value">59</span>) <span class="ruby-comment"># =&gt; 2000-01-01 00:59:00 UTC</span>
</pre>
</li><li>
<p><code>sec</code>: Second in range (0..59), or 60 if <code>usec</code> is zero:</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>)  <span class="ruby-comment"># =&gt; 2000-01-01 00:00:00 UTC</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">59</span>) <span class="ruby-comment"># =&gt; 2000-01-01 00:00:59 UTC</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">60</span>) <span class="ruby-comment"># =&gt; 2000-01-01 00:01:00 UTC</span>
</pre>
</li><li>
<p><code>usec</code>: Microsecond in range (0..999999):</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>)      <span class="ruby-comment"># =&gt; 2000-01-01 00:00:00 UTC</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">999999</span>) <span class="ruby-comment"># =&gt; 2000-01-01 00:00:00.999999 UTC</span>
</pre>
</li></ul>

<p>The values may be:</p>
<ul><li>
<p>Integers, as above.</p>
</li><li>
<p>Numerics convertible to integers:</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-constant">Float</span>(<span class="ruby-value">0.0</span>), <span class="ruby-constant">Rational</span>(<span class="ruby-value">1</span>, <span class="ruby-value">1</span>), <span class="ruby-value">1.0</span>, <span class="ruby-value">0.0</span>, <span class="ruby-value">0.0</span>, <span class="ruby-value">0.0</span>, <span class="ruby-value">0.0</span>)
<span class="ruby-comment"># =&gt; 0000-01-01 00:00:00 UTC</span>
</pre>
</li><li>
<p><a href="String.html"><code>String</code></a> integers:</p>

<pre class="ruby"><span class="ruby-identifier">a</span> = <span class="ruby-node">%w[0 1 1 0 0 0 0 0]</span>
<span class="ruby-comment"># =&gt; [&quot;0&quot;, &quot;1&quot;, &quot;1&quot;, &quot;0&quot;, &quot;0&quot;, &quot;0&quot;, &quot;0&quot;, &quot;0&quot;]</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">a</span>) <span class="ruby-comment"># =&gt; 0000-01-01 00:00:00 UTC</span>
</pre>
</li></ul>

<p>When exactly ten arguments are given, the arguments are interpreted as in the second calling sequence above:</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-identifier">sec</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">mday</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">year</span>, <span class="ruby-identifier">dummy</span>, <span class="ruby-identifier">dummy</span>, <span class="ruby-identifier">dummy</span>, <span class="ruby-identifier">dummy</span>)
</pre>

<p>where the <code>dummy</code> arguments are ignored:</p>

<pre class="ruby"><span class="ruby-identifier">a</span> = [<span class="ruby-value">0</span>, <span class="ruby-value">1</span>, <span class="ruby-value">2</span>, <span class="ruby-value">3</span>, <span class="ruby-value">4</span>, <span class="ruby-value">5</span>, <span class="ruby-value">6</span>, <span class="ruby-value">7</span>, <span class="ruby-value">8</span>, <span class="ruby-value">9</span>]
<span class="ruby-comment"># =&gt; [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">a</span>) <span class="ruby-comment"># =&gt; 0005-04-03 02:01:00 UTC</span>
</pre>

<p>This form is useful for creating a Time object from a 10-element array returned by <a href="Time.html#method-i-to_a"><code>Time.to_a</code></a>:</p>

<pre class="ruby"><span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">2</span>, <span class="ruby-value">3</span>, <span class="ruby-value">4</span>, <span class="ruby-value">5</span>, <span class="ruby-value">6</span>) <span class="ruby-comment"># =&gt; 2000-01-02 03:04:05 +000006</span>
<span class="ruby-identifier">a</span> = <span class="ruby-identifier">t</span>.<span class="ruby-identifier">to_a</span>   <span class="ruby-comment"># =&gt; [5, 4, 3, 2, 1, 2000, 0, 2, false, nil]</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">a</span>) <span class="ruby-comment"># =&gt; 2000-01-02 03:04:05 UTC</span>
</pre>

<p>The two forms have their first six arguments in common, though in different orders; the ranges of these common arguments are the same for both forms; see above.</p>

<p>Raises an exception if the number of arguments is eight, nine, or greater than ten.</p>

<p>Related: <a href="Time.html#method-c-local"><code>Time.local</code></a>.</p>

                              <div class="method-source-code" id="utc-source">
            <pre>static VALUE
time_s_mkutc(int argc, VALUE *argv, VALUE klass)
{
    struct vtm vtm;

    time_arg(argc, argv, &amp;vtm);
    return time_gmtime(time_new_timew(klass, timegmw(&amp;vtm)));
}</pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="Time.html#method-c-gm">gm</a>
                            </div>

                          </div>

                          </section>

                <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Instance Methods</h3>
                </header>

                  <div id="method-i-2B" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          self + numeric &rarr; new_time
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns a new Time object whose value is the sum of the numeric value of <code>self</code> and the given <code>numeric</code>:</p>

<pre class="ruby"><span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>) <span class="ruby-comment"># =&gt; 2000-01-01 00:00:00 -0600</span>
<span class="ruby-identifier">t</span> <span class="ruby-operator">+</span> (<span class="ruby-value">60</span> <span class="ruby-operator">*</span> <span class="ruby-value">60</span> <span class="ruby-operator">*</span> <span class="ruby-value">24</span>) <span class="ruby-comment"># =&gt; 2000-01-02 00:00:00 -0600</span>
<span class="ruby-identifier">t</span> <span class="ruby-operator">+</span> <span class="ruby-value">0.5</span>            <span class="ruby-comment"># =&gt; 2000-01-01 00:00:00.5 -0600</span>
</pre>

<p>Related: <a href="Time.html#method-i-2D"><code>Time#-</code></a>.</p>

                              <div class="method-source-code" id="2B-source">
            <pre>static VALUE
time_plus(VALUE time1, VALUE time2)
{
    struct time_object *tobj;
    GetTimeval(time1, tobj);

    if (IsTimeval(time2)) {
        rb_raise(rb_eTypeError, &quot;time + time?&quot;);
    }
    return time_add(tobj, time1, time2, 1);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-2D" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          self - numeric &rarr; new_time
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>
                      <div class="method-heading">
                        <span class="method-callseq">
                          self - other_time &rarr; float
                              </span>
                            </div>

                            <div class="method-description">
                              <p>When <code>numeric</code> is given, returns a new Time object whose value is the difference of the numeric value of <code>self</code> and <code>numeric</code>:</p>

<pre class="ruby"><span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>) <span class="ruby-comment"># =&gt; 2000-01-01 00:00:00 -0600</span>
<span class="ruby-identifier">t</span> <span class="ruby-operator">-</span> (<span class="ruby-value">60</span> <span class="ruby-operator">*</span> <span class="ruby-value">60</span> <span class="ruby-operator">*</span> <span class="ruby-value">24</span>) <span class="ruby-comment"># =&gt; 1999-12-31 00:00:00 -0600</span>
<span class="ruby-identifier">t</span> <span class="ruby-operator">-</span> <span class="ruby-value">0.5</span>            <span class="ruby-comment"># =&gt; 1999-12-31 23:59:59.5 -0600</span>
</pre>

<p>When <code>other_time</code> is given, returns a <a href="Float.html"><code>Float</code></a> whose value is the difference of the numeric values of <code>self</code> and <code>other_time</code> in seconds:</p>

<pre class="ruby"><span class="ruby-identifier">t</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">t</span> <span class="ruby-comment"># =&gt; 0.0</span>
</pre>

<p>Related: <a href="Time.html#method-i-2B"><code>Time#+</code></a>.</p>

                              <div class="method-source-code" id="2D-source">
            <pre>static VALUE
time_minus(VALUE time1, VALUE time2)
{
    struct time_object *tobj;

    GetTimeval(time1, tobj);
    if (IsTimeval(time2)) {
        struct time_object *tobj2;

        GetTimeval(time2, tobj2);
        return rb_Float(rb_time_unmagnify_to_float(wsub(tobj-&gt;timew, tobj2-&gt;timew)));
    }
    return time_add(tobj, time1, time2, -1);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-3C-3D-3E" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          self &lt;=&gt; other_time &rarr; -1, 0, +1, or nil
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Compares <code>self</code> with <code>other_time</code>; returns:</p>
<ul><li>
<p><code>-1</code>, if <code>self</code> is less than <code>other_time</code>.</p>
</li><li>
<p><code>0</code>, if <code>self</code> is equal to <code>other_time</code>.</p>
</li><li>
<p><code>1</code>, if <code>self</code> is greater then <code>other_time</code>.</p>
</li><li>
<p><code>nil</code>, if <code>self</code> and <code>other_time</code> are incomparable.</p>
</li></ul>

<p>Examples:</p>

<pre class="ruby"><span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>     <span class="ruby-comment"># =&gt; 2007-11-19 08:12:12 -0600</span>
<span class="ruby-identifier">t2</span> = <span class="ruby-identifier">t</span> <span class="ruby-operator">+</span> <span class="ruby-value">2592000</span> <span class="ruby-comment"># =&gt; 2007-12-19 08:12:12 -0600</span>
<span class="ruby-identifier">t</span> <span class="ruby-operator">&lt;=&gt;</span> <span class="ruby-identifier">t2</span>         <span class="ruby-comment"># =&gt; -1</span>
<span class="ruby-identifier">t2</span> <span class="ruby-operator">&lt;=&gt;</span> <span class="ruby-identifier">t</span>         <span class="ruby-comment"># =&gt; 1</span>

<span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>     <span class="ruby-comment"># =&gt; 2007-11-19 08:13:38 -0600</span>
<span class="ruby-identifier">t2</span> = <span class="ruby-identifier">t</span> <span class="ruby-operator">+</span> <span class="ruby-value">0.1</span>     <span class="ruby-comment"># =&gt; 2007-11-19 08:13:38 -0600</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">nsec</span>           <span class="ruby-comment"># =&gt; 98222999</span>
<span class="ruby-identifier">t2</span>.<span class="ruby-identifier">nsec</span>          <span class="ruby-comment"># =&gt; 198222999</span>
<span class="ruby-identifier">t</span> <span class="ruby-operator">&lt;=&gt;</span> <span class="ruby-identifier">t2</span>         <span class="ruby-comment"># =&gt; -1</span>
<span class="ruby-identifier">t2</span> <span class="ruby-operator">&lt;=&gt;</span> <span class="ruby-identifier">t</span>         <span class="ruby-comment"># =&gt; 1</span>
<span class="ruby-identifier">t</span> <span class="ruby-operator">&lt;=&gt;</span> <span class="ruby-identifier">t</span>          <span class="ruby-comment"># =&gt; 0</span>
</pre>

                              <div class="method-source-code" id="3C-3D-3E-source">
            <pre>static VALUE
time_cmp(VALUE time1, VALUE time2)
{
    struct time_object *tobj1, *tobj2;
    int n;

    GetTimeval(time1, tobj1);
    if (IsTimeval(time2)) {
        GetTimeval(time2, tobj2);
        n = wcmp(tobj1-&gt;timew, tobj2-&gt;timew);
    }
    else {
        return rb_invcmp(time1, time2);
    }
    if (n == 0) return INT2FIX(0);
    if (n &gt; 0) return INT2FIX(1);
    return INT2FIX(-1);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-asctime" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">asctime</span><span
                                class="method-args">()</span>
                            </div>

                            <div class="method-description">
                              <p>Returns a string representation of <code>self</code>, formatted by <code>strftime(&#39;%a %b %e %T %Y&#39;)</code> or its shorthand version <code>strftime(&#39;%c&#39;)</code>; see <a href="strftime_formatting_rdoc.html">Formats for Dates and Times</a>:</p>

<pre class="ruby"><span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">12</span>, <span class="ruby-value">31</span>, <span class="ruby-value">23</span>, <span class="ruby-value">59</span>, <span class="ruby-value">59</span>, <span class="ruby-value">0.5</span>)
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">ctime</span>                      <span class="ruby-comment"># =&gt; &quot;Sun Dec 31 23:59:59 2000&quot;</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-string">&#39;%a %b %e %T %Y&#39;</span>) <span class="ruby-comment"># =&gt; &quot;Sun Dec 31 23:59:59 2000&quot;</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-string">&#39;%c&#39;</span>)             <span class="ruby-comment"># =&gt; &quot;Sun Dec 31 23:59:59 2000&quot;</span>
</pre>

<p>Related: <a href="Time.html#method-i-to_s"><code>Time#to_s</code></a>, <a href="Time.html#method-i-inspect"><code>Time#inspect</code></a>:</p>

<pre class="ruby"><span class="ruby-identifier">t</span>.<span class="ruby-identifier">inspect</span>                    <span class="ruby-comment"># =&gt; &quot;2000-12-31 23:59:59.5 +000001&quot;</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">to_s</span>                       <span class="ruby-comment"># =&gt; &quot;2000-12-31 23:59:59 +0000&quot;</span>
</pre>

                            </div>


                            <div class="aliases">
                              Alias for: <a href="Time.html#method-i-ctime">ctime</a>
                            </div>
                          </div>

                  <div id="method-i-ceil" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          ceil(ndigits = 0)   &rarr; new_time
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns a new Time object whose numerical value is greater than or equal to <code>self</code> with its seconds truncated to precision <code>ndigits</code>:</p>

<pre class="ruby"><span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2010</span>, <span class="ruby-value">3</span>, <span class="ruby-value">30</span>, <span class="ruby-value">5</span>, <span class="ruby-value">43</span>, <span class="ruby-value">25.123456789r</span>)
<span class="ruby-identifier">t</span>          <span class="ruby-comment"># =&gt; 2010-03-30 05:43:25.123456789 UTC</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">ceil</span>     <span class="ruby-comment"># =&gt; 2010-03-30 05:43:26 UTC</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">ceil</span>(<span class="ruby-value">2</span>)  <span class="ruby-comment"># =&gt; 2010-03-30 05:43:25.13 UTC</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">ceil</span>(<span class="ruby-value">4</span>)  <span class="ruby-comment"># =&gt; 2010-03-30 05:43:25.1235 UTC</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">ceil</span>(<span class="ruby-value">6</span>)  <span class="ruby-comment"># =&gt; 2010-03-30 05:43:25.123457 UTC</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">ceil</span>(<span class="ruby-value">8</span>)  <span class="ruby-comment"># =&gt; 2010-03-30 05:43:25.12345679 UTC</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">ceil</span>(<span class="ruby-value">10</span>) <span class="ruby-comment"># =&gt; 2010-03-30 05:43:25.123456789 UTC</span>

<span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">1999</span>, <span class="ruby-value">12</span>, <span class="ruby-value">31</span>, <span class="ruby-value">23</span>, <span class="ruby-value">59</span>, <span class="ruby-value">59</span>)
<span class="ruby-identifier">t</span>              <span class="ruby-comment"># =&gt; 1999-12-31 23:59:59 UTC</span>
(<span class="ruby-identifier">t</span> <span class="ruby-operator">+</span> <span class="ruby-value">0.4</span>).<span class="ruby-identifier">ceil</span> <span class="ruby-comment"># =&gt; 2000-01-01 00:00:00 UTC</span>
(<span class="ruby-identifier">t</span> <span class="ruby-operator">+</span> <span class="ruby-value">0.9</span>).<span class="ruby-identifier">ceil</span> <span class="ruby-comment"># =&gt; 2000-01-01 00:00:00 UTC</span>
(<span class="ruby-identifier">t</span> <span class="ruby-operator">+</span> <span class="ruby-value">1.4</span>).<span class="ruby-identifier">ceil</span> <span class="ruby-comment"># =&gt; 2000-01-01 00:00:01 UTC</span>
(<span class="ruby-identifier">t</span> <span class="ruby-operator">+</span> <span class="ruby-value">1.9</span>).<span class="ruby-identifier">ceil</span> <span class="ruby-comment"># =&gt; 2000-01-01 00:00:01 UTC</span>
</pre>

<p>Related: <a href="Time.html#method-i-floor"><code>Time#floor</code></a>, <a href="Time.html#method-i-round"><code>Time#round</code></a>.</p>

                              <div class="method-source-code" id="ceil-source">
            <pre>static VALUE
time_ceil(int argc, VALUE *argv, VALUE time)
{
    VALUE ndigits, v, den;
    struct time_object *tobj;

    if (!rb_check_arity(argc, 0, 1) || NIL_P(ndigits = argv[0]))
        den = INT2FIX(1);
    else
        den = ndigits_denominator(ndigits);

    GetTimeval(time, tobj);
    v = w2v(rb_time_unmagnify(tobj-&gt;timew));

    v = modv(v, den);
    if (!rb_equal(v, INT2FIX(0))) {
        v = subv(den, v);
    }
    return time_add(tobj, time, v, 1);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-ctime" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          ctime &rarr; string
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns a string representation of <code>self</code>, formatted by <code>strftime(&#39;%a %b %e %T %Y&#39;)</code> or its shorthand version <code>strftime(&#39;%c&#39;)</code>; see <a href="strftime_formatting_rdoc.html">Formats for Dates and Times</a>:</p>

<pre class="ruby"><span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">12</span>, <span class="ruby-value">31</span>, <span class="ruby-value">23</span>, <span class="ruby-value">59</span>, <span class="ruby-value">59</span>, <span class="ruby-value">0.5</span>)
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">ctime</span>                      <span class="ruby-comment"># =&gt; &quot;Sun Dec 31 23:59:59 2000&quot;</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-string">&#39;%a %b %e %T %Y&#39;</span>) <span class="ruby-comment"># =&gt; &quot;Sun Dec 31 23:59:59 2000&quot;</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-string">&#39;%c&#39;</span>)             <span class="ruby-comment"># =&gt; &quot;Sun Dec 31 23:59:59 2000&quot;</span>
</pre>

<p>Related: <a href="Time.html#method-i-to_s"><code>Time#to_s</code></a>, <a href="Time.html#method-i-inspect"><code>Time#inspect</code></a>:</p>

<pre class="ruby"><span class="ruby-identifier">t</span>.<span class="ruby-identifier">inspect</span>                    <span class="ruby-comment"># =&gt; &quot;2000-12-31 23:59:59.5 +000001&quot;</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">to_s</span>                       <span class="ruby-comment"># =&gt; &quot;2000-12-31 23:59:59 +0000&quot;</span>
</pre>

                              <div class="method-source-code" id="ctime-source">
            <pre>static VALUE
time_asctime(VALUE time)
{
    return strftimev(&quot;%a %b %e %T %Y&quot;, time, rb_usascii_encoding());
}</pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="Time.html#method-i-asctime">asctime</a>
                            </div>

                          </div>

                  <div id="method-i-day" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">day</span><span
                                class="method-args">()</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the integer day of the month for <code>self</code>, in range (1..31):</p>

<pre class="ruby"><span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">2</span>, <span class="ruby-value">3</span>, <span class="ruby-value">4</span>, <span class="ruby-value">5</span>, <span class="ruby-value">6</span>)
<span class="ruby-comment"># =&gt; 2000-01-02 03:04:05 +000006</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">mday</span> <span class="ruby-comment"># =&gt; 2</span>
</pre>

<p>Related: <a href="Time.html#method-i-year"><code>Time#year</code></a>, <a href="Time.html#method-i-hour"><code>Time#hour</code></a>, <a href="Time.html#method-i-min"><code>Time#min</code></a>.</p>

                            </div>


                            <div class="aliases">
                              Alias for: <a href="Time.html#method-i-mday">mday</a>
                            </div>
                          </div>

                  <div id="method-i-deconstruct_keys" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          deconstruct_keys(array_of_names_or_nil) &rarr; hash
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns a hash of the name/value pairs, to use in pattern matching. Possible keys are: <code>:year</code>, <code>:month</code>, <code>:day</code>, <code>:yday</code>, <code>:wday</code>, <code>:hour</code>, <code>:min</code>, <code>:sec</code>, <code>:subsec</code>, <code>:dst</code>, <code>:zone</code>.</p>

<p>Possible usages:</p>

<pre class="ruby"><span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2022</span>, <span class="ruby-value">10</span>, <span class="ruby-value">5</span>, <span class="ruby-value">21</span>, <span class="ruby-value">25</span>, <span class="ruby-value">30</span>)

<span class="ruby-keyword">if</span> <span class="ruby-identifier">t</span> <span class="ruby-keyword">in</span> <span class="ruby-value">wday:</span> <span class="ruby-value">3</span>, <span class="ruby-value">day:</span> <span class="ruby-operator">..</span><span class="ruby-value">7</span>  <span class="ruby-comment"># uses deconstruct_keys underneath</span>
  <span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;first Wednesday of the month&quot;</span>
<span class="ruby-keyword">end</span>
<span class="ruby-comment">#=&gt; prints &quot;first Wednesday of the month&quot;</span>

<span class="ruby-keyword">case</span> <span class="ruby-identifier">t</span>
<span class="ruby-keyword">in</span> <span class="ruby-value">year:</span> <span class="ruby-operator">...</span><span class="ruby-value">2022</span>
  <span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;too old&quot;</span>
<span class="ruby-keyword">in</span> <span class="ruby-value">month:</span> <span class="ruby-operator">..</span><span class="ruby-value">9</span>
  <span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;quarter 1-3&quot;</span>
<span class="ruby-keyword">in</span> <span class="ruby-value">wday:</span> <span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">5</span>, <span class="ruby-value">month:</span>
  <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;working day in month #{month}&quot;</span>
<span class="ruby-keyword">end</span>
<span class="ruby-comment">#=&gt; prints &quot;working day in month 10&quot;</span>
</pre>

<p>Note that deconstruction by pattern can also be combined with class check:</p>

<pre class="ruby"><span class="ruby-keyword">if</span> <span class="ruby-identifier">t</span> <span class="ruby-keyword">in</span> <span class="ruby-constant">Time</span>(<span class="ruby-value">wday:</span> <span class="ruby-value">3</span>, <span class="ruby-value">day:</span> <span class="ruby-operator">..</span><span class="ruby-value">7</span>)
  <span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;first Wednesday of the month&quot;</span>
<span class="ruby-keyword">end</span>
</pre>

                              <div class="method-source-code" id="deconstruct_keys-source">
            <pre>static VALUE
time_deconstruct_keys(VALUE time, VALUE keys)
{
    struct time_object *tobj;
    VALUE h;
    long i;

    GetTimeval(time, tobj);
    MAKE_TM_ENSURE(time, tobj, tobj-&gt;vtm.yday != 0);

    if (NIL_P(keys)) {
        h = rb_hash_new_with_size(11);

        rb_hash_aset(h, sym_year, tobj-&gt;vtm.year);
        rb_hash_aset(h, sym_month, INT2FIX(tobj-&gt;vtm.mon));
        rb_hash_aset(h, sym_day, INT2FIX(tobj-&gt;vtm.mday));
        rb_hash_aset(h, sym_yday, INT2FIX(tobj-&gt;vtm.yday));
        rb_hash_aset(h, sym_wday, INT2FIX(tobj-&gt;vtm.wday));
        rb_hash_aset(h, sym_hour, INT2FIX(tobj-&gt;vtm.hour));
        rb_hash_aset(h, sym_min, INT2FIX(tobj-&gt;vtm.min));
        rb_hash_aset(h, sym_sec, INT2FIX(tobj-&gt;vtm.sec));
        rb_hash_aset(h, sym_subsec,
                     quov(w2v(wmod(tobj-&gt;timew, WINT2FIXWV(TIME_SCALE))), INT2FIX(TIME_SCALE)));
        rb_hash_aset(h, sym_dst, RBOOL(tobj-&gt;vtm.isdst));
        rb_hash_aset(h, sym_zone, time_zone(time));

        return h;
    }
    if (UNLIKELY(!RB_TYPE_P(keys, T_ARRAY))) {
        rb_raise(rb_eTypeError,
                 &quot;wrong argument type %&quot;PRIsVALUE&quot; (expected Array or nil)&quot;,
                 rb_obj_class(keys));

    }

    h = rb_hash_new_with_size(RARRAY_LEN(keys));

    for (i=0; i&lt;RARRAY_LEN(keys); i++) {
        VALUE key = RARRAY_AREF(keys, i);

        if (sym_year == key) rb_hash_aset(h, key, tobj-&gt;vtm.year);
        if (sym_month == key) rb_hash_aset(h, key, INT2FIX(tobj-&gt;vtm.mon));
        if (sym_day == key) rb_hash_aset(h, key, INT2FIX(tobj-&gt;vtm.mday));
        if (sym_yday == key) rb_hash_aset(h, key, INT2FIX(tobj-&gt;vtm.yday));
        if (sym_wday == key) rb_hash_aset(h, key, INT2FIX(tobj-&gt;vtm.wday));
        if (sym_hour == key) rb_hash_aset(h, key, INT2FIX(tobj-&gt;vtm.hour));
        if (sym_min == key) rb_hash_aset(h, key, INT2FIX(tobj-&gt;vtm.min));
        if (sym_sec == key) rb_hash_aset(h, key, INT2FIX(tobj-&gt;vtm.sec));
        if (sym_subsec == key) {
            rb_hash_aset(h, key, quov(w2v(wmod(tobj-&gt;timew, WINT2FIXWV(TIME_SCALE))), INT2FIX(TIME_SCALE)));
        }
        if (sym_dst == key) rb_hash_aset(h, key, RBOOL(tobj-&gt;vtm.isdst));
        if (sym_zone == key) rb_hash_aset(h, key, time_zone(time));
    }
    return h;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-dst-3F" class="method-detail method-alias">
                      <div class="method-heading">
                        <span class="method-callseq">
                          dst?  &rarr; true or false
                              </span>
                            </div>

                            <div class="method-description">
                              <p>Returns <code>true</code> if <code>self</code> is in daylight saving time, <code>false</code> otherwise:</p>

<pre class="ruby"><span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">local</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>) <span class="ruby-comment"># =&gt; 2000-01-01 00:00:00 -0600</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">zone</span>                     <span class="ruby-comment"># =&gt; &quot;Central Standard Time&quot;</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">dst?</span>                     <span class="ruby-comment"># =&gt; false</span>
<span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">local</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">7</span>, <span class="ruby-value">1</span>) <span class="ruby-comment"># =&gt; 2000-07-01 00:00:00 -0500</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">zone</span>                     <span class="ruby-comment"># =&gt; &quot;Central Daylight Time&quot;</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">dst?</span>                     <span class="ruby-comment"># =&gt; true</span>
</pre>

                            </div>


                            <div class="aliases">
                              Alias for: <a href="Time.html#method-i-isdst">isdst</a>
                            </div>
                          </div>

                  <div id="method-i-eql-3F" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          eql?(other_time)
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns <code>true</code> if <code>self</code> and <code>other_time</code> are both Time objects with the exact same time value.</p>

                              <div class="method-source-code" id="eql-3F-source">
            <pre>static VALUE
time_eql(VALUE time1, VALUE time2)
{
    struct time_object *tobj1, *tobj2;

    GetTimeval(time1, tobj1);
    if (IsTimeval(time2)) {
        GetTimeval(time2, tobj2);
        return rb_equal(w2v(tobj1-&gt;timew), w2v(tobj2-&gt;timew));
    }
    return Qfalse;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-floor" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          floor(ndigits = 0) &rarr; new_time
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns a new Time object whose numerical value is less than or equal to <code>self</code> with its seconds truncated to precision <code>ndigits</code>:</p>

<pre class="ruby"><span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2010</span>, <span class="ruby-value">3</span>, <span class="ruby-value">30</span>, <span class="ruby-value">5</span>, <span class="ruby-value">43</span>, <span class="ruby-value">25.123456789r</span>)
<span class="ruby-identifier">t</span>           <span class="ruby-comment"># =&gt; 2010-03-30 05:43:25.123456789 UTC</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">floor</span>     <span class="ruby-comment"># =&gt; 2010-03-30 05:43:25 UTC</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">floor</span>(<span class="ruby-value">2</span>)  <span class="ruby-comment"># =&gt; 2010-03-30 05:43:25.12 UTC</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">floor</span>(<span class="ruby-value">4</span>)  <span class="ruby-comment"># =&gt; 2010-03-30 05:43:25.1234 UTC</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">floor</span>(<span class="ruby-value">6</span>)  <span class="ruby-comment"># =&gt; 2010-03-30 05:43:25.123456 UTC</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">floor</span>(<span class="ruby-value">8</span>)  <span class="ruby-comment"># =&gt; 2010-03-30 05:43:25.12345678 UTC</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">floor</span>(<span class="ruby-value">10</span>) <span class="ruby-comment"># =&gt; 2010-03-30 05:43:25.123456789 UTC</span>

<span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">1999</span>, <span class="ruby-value">12</span>, <span class="ruby-value">31</span>, <span class="ruby-value">23</span>, <span class="ruby-value">59</span>, <span class="ruby-value">59</span>)
<span class="ruby-identifier">t</span>               <span class="ruby-comment"># =&gt; 1999-12-31 23:59:59 UTC</span>
(<span class="ruby-identifier">t</span> <span class="ruby-operator">+</span> <span class="ruby-value">0.4</span>).<span class="ruby-identifier">floor</span> <span class="ruby-comment"># =&gt; 1999-12-31 23:59:59 UTC</span>
(<span class="ruby-identifier">t</span> <span class="ruby-operator">+</span> <span class="ruby-value">0.9</span>).<span class="ruby-identifier">floor</span> <span class="ruby-comment"># =&gt; 1999-12-31 23:59:59 UTC</span>
(<span class="ruby-identifier">t</span> <span class="ruby-operator">+</span> <span class="ruby-value">1.4</span>).<span class="ruby-identifier">floor</span> <span class="ruby-comment"># =&gt; 2000-01-01 00:00:00 UTC</span>
(<span class="ruby-identifier">t</span> <span class="ruby-operator">+</span> <span class="ruby-value">1.9</span>).<span class="ruby-identifier">floor</span> <span class="ruby-comment"># =&gt; 2000-01-01 00:00:00 UTC</span>
</pre>

<p>Related: <a href="Time.html#method-i-ceil"><code>Time#ceil</code></a>, <a href="Time.html#method-i-round"><code>Time#round</code></a>.</p>

                              <div class="method-source-code" id="floor-source">
            <pre>static VALUE
time_floor(int argc, VALUE *argv, VALUE time)
{
    VALUE ndigits, v, den;
    struct time_object *tobj;

    if (!rb_check_arity(argc, 0, 1) || NIL_P(ndigits = argv[0]))
        den = INT2FIX(1);
    else
        den = ndigits_denominator(ndigits);

    GetTimeval(time, tobj);
    v = w2v(rb_time_unmagnify(tobj-&gt;timew));

    v = modv(v, den);
    return time_add(tobj, time, v, -1);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-friday-3F" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          friday? &rarr; true or false
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns <code>true</code> if <code>self</code> represents a Friday, <code>false</code> otherwise:</p>

<pre class="ruby"><span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">7</span>) <span class="ruby-comment"># =&gt; 2000-01-07 00:00:00 UTC</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">friday?</span>                <span class="ruby-comment"># =&gt; true</span>
</pre>

<p>Related: <a href="Time.html#method-i-saturday-3F"><code>Time#saturday?</code></a>, <a href="Time.html#method-i-sunday-3F"><code>Time#sunday?</code></a>, <a href="Time.html#method-i-monday-3F"><code>Time#monday?</code></a>.</p>

                              <div class="method-source-code" id="friday-3F-source">
            <pre>static VALUE
time_friday(VALUE time)
{
    wday_p(5);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-getgm" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">getgm</span><span
                                class="method-args"> -&gt; new_time</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns a new Time object representing the value of <code>self</code> converted to the UTC timezone:</p>

<pre class="ruby"><span class="ruby-identifier">local</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">local</span>(<span class="ruby-value">2000</span>) <span class="ruby-comment"># =&gt; 2000-01-01 00:00:00 -0600</span>
<span class="ruby-identifier">local</span>.<span class="ruby-identifier">utc?</span>               <span class="ruby-comment"># =&gt; false</span>
<span class="ruby-identifier">utc</span> = <span class="ruby-identifier">local</span>.<span class="ruby-identifier">getutc</span>       <span class="ruby-comment"># =&gt; 2000-01-01 06:00:00 UTC</span>
<span class="ruby-identifier">utc</span>.<span class="ruby-identifier">utc?</span>                 <span class="ruby-comment"># =&gt; true</span>
<span class="ruby-identifier">utc</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">local</span>             <span class="ruby-comment"># =&gt; true</span>
</pre>

                              <div class="method-source-code" id="getgm-source">
            <pre>static VALUE
time_getgmtime(VALUE time)
{
    return time_gmtime(time_dup(time));
}</pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="Time.html#method-i-getutc">getutc</a>
                            </div>

                          </div>

                  <div id="method-i-getlocal" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          getlocal(zone = nil) &rarr; new_time
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns a new Time object representing the value of <code>self</code> converted to a given timezone; if <code>zone</code> is <code>nil</code>, the local timezone is used:</p>

<pre class="ruby"><span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>)                    <span class="ruby-comment"># =&gt; 2000-01-01 00:00:00 UTC</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">getlocal</span>                            <span class="ruby-comment"># =&gt; 1999-12-31 18:00:00 -0600</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">getlocal</span>(<span class="ruby-string">&#39;+12:00&#39;</span>)                  <span class="ruby-comment"># =&gt; 2000-01-01 12:00:00 +1200</span>
</pre>

<p>For forms of argument <code>zone</code>, see <a href="timezones_rdoc.html">Timezone Specifiers</a>.</p>

                              <div class="method-source-code" id="getlocal-source">
            <pre>static VALUE
time_getlocaltime(int argc, VALUE *argv, VALUE time)
{
    VALUE off;

    if (rb_check_arity(argc, 0, 1) &amp;&amp; !NIL_P(off = argv[0])) {
        VALUE zone = off;
        if (maybe_tzobj_p(zone)) {
            VALUE t = time_dup(time);
            if (zone_localtime(off, t)) return t;
        }

        if (NIL_P(off = utc_offset_arg(off))) {
            off = zone;
            if (NIL_P(zone = find_timezone(time, off))) invalid_utc_offset(off);
            time = time_dup(time);
            if (!zone_localtime(zone, time)) invalid_utc_offset(off);
            return time;
        }
        else if (off == UTC_ZONE) {
            return time_gmtime(time_dup(time));
        }
        validate_utc_offset(off);

        time = time_dup(time);
        time_set_utc_offset(time, off);
        return time_fixoff(time);
    }

    return time_localtime(time_dup(time));
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-getutc" class="method-detail method-alias">
                      <div class="method-heading">
                        <span class="method-callseq">
                          getutc &rarr; new_time
                              </span>
                            </div>

                            <div class="method-description">
                              <p>Returns a new Time object representing the value of <code>self</code> converted to the UTC timezone:</p>

<pre class="ruby"><span class="ruby-identifier">local</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">local</span>(<span class="ruby-value">2000</span>) <span class="ruby-comment"># =&gt; 2000-01-01 00:00:00 -0600</span>
<span class="ruby-identifier">local</span>.<span class="ruby-identifier">utc?</span>               <span class="ruby-comment"># =&gt; false</span>
<span class="ruby-identifier">utc</span> = <span class="ruby-identifier">local</span>.<span class="ruby-identifier">getutc</span>       <span class="ruby-comment"># =&gt; 2000-01-01 06:00:00 UTC</span>
<span class="ruby-identifier">utc</span>.<span class="ruby-identifier">utc?</span>                 <span class="ruby-comment"># =&gt; true</span>
<span class="ruby-identifier">utc</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">local</span>             <span class="ruby-comment"># =&gt; true</span>
</pre>

                            </div>


                            <div class="aliases">
                              Alias for: <a href="Time.html#method-i-getgm">getgm</a>
                            </div>
                          </div>

                  <div id="method-i-gmt-3F" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">gmt?</span><span
                                class="method-args">()</span>
                            </div>

                            <div class="method-description">
                              <p>Returns <code>true</code> if <code>self</code> represents a time in UTC (GMT):</p>

<pre class="ruby"><span class="ruby-identifier">now</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
<span class="ruby-comment"># =&gt; 2022-08-18 10:24:13.5398485 -0500</span>
<span class="ruby-identifier">now</span>.<span class="ruby-identifier">utc?</span> <span class="ruby-comment"># =&gt; false</span>
<span class="ruby-identifier">utc</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">20</span>, <span class="ruby-value">15</span>, <span class="ruby-value">1</span>)
<span class="ruby-comment"># =&gt; 2000-01-01 20:15:01 UTC</span>
<span class="ruby-identifier">utc</span>.<span class="ruby-identifier">utc?</span> <span class="ruby-comment"># =&gt; true</span>
</pre>

<p>Related: <a href="Time.html#method-c-utc"><code>Time.utc</code></a>.</p>

                            </div>


                            <div class="aliases">
                              Alias for: <a href="Time.html#method-i-utc-3F">utc?</a>
                            </div>
                          </div>

                  <div id="method-i-gmt_offset" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">gmt_offset</span><span
                                class="method-args">()</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the offset in seconds between the timezones of UTC and <code>self</code>:</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>).<span class="ruby-identifier">utc_offset</span>   <span class="ruby-comment"># =&gt; 0</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">local</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>).<span class="ruby-identifier">utc_offset</span> <span class="ruby-comment"># =&gt; -21600 # -6*3600, or minus six hours.</span>
</pre>

                            </div>


                            <div class="aliases">
                              Alias for: <a href="Time.html#method-i-gmtoff">gmtoff</a>
                            </div>
                          </div>

                  <div id="method-i-gmtime" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">gmtime</span><span
                                class="method-args"> -&gt; self</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns <code>self</code>, converted to the UTC timezone:</p>

<pre class="ruby"><span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>) <span class="ruby-comment"># =&gt; 2000-01-01 00:00:00 -0600</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">utc?</span>             <span class="ruby-comment"># =&gt; false</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">utc</span>              <span class="ruby-comment"># =&gt; 2000-01-01 06:00:00 UTC</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">utc?</span>             <span class="ruby-comment"># =&gt; true</span>
</pre>

<p>Related: <a href="Time.html#method-i-getutc"><code>Time#getutc</code></a> (returns a new converted Time object).</p>

                              <div class="method-source-code" id="gmtime-source">
            <pre>static VALUE
time_gmtime(VALUE time)
{
    struct time_object *tobj;
    struct vtm vtm;

    GetTimeval(time, tobj);
    if (TZMODE_UTC_P(tobj)) {
        if (tobj-&gt;vtm.tm_got)
            return time;
    }
    else {
        time_modify(time);
    }

    vtm.zone = str_utc;
    GMTIMEW(tobj-&gt;timew, &amp;vtm);
    time_set_vtm(time, tobj, vtm);

    tobj-&gt;vtm.tm_got = 1;
    TZMODE_SET_UTC(tobj);
    return time;
}</pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="Time.html#method-i-utc">utc</a>
                            </div>

                          </div>

                  <div id="method-i-gmtoff" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">gmtoff</span><span
                                class="method-args"> -&gt; integer</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the offset in seconds between the timezones of UTC and <code>self</code>:</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>).<span class="ruby-identifier">utc_offset</span>   <span class="ruby-comment"># =&gt; 0</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">local</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>).<span class="ruby-identifier">utc_offset</span> <span class="ruby-comment"># =&gt; -21600 # -6*3600, or minus six hours.</span>
</pre>

                              <div class="method-source-code" id="gmtoff-source">
            <pre>VALUE
rb_time_utc_offset(VALUE time)
{
    struct time_object *tobj;

    GetTimeval(time, tobj);

    if (TZMODE_UTC_P(tobj)) {
        return INT2FIX(0);
    }
    else {
        MAKE_TM(time, tobj);
        return tobj-&gt;vtm.utc_offset;
    }
}</pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="Time.html#method-i-gmt_offset">gmt_offset</a>, <a href="Time.html#method-i-utc_offset">utc_offset</a>
                            </div>

                          </div>

                  <div id="method-i-hash" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          hash &rarr; integer
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the integer hash code for <code>self</code>.</p>

<p>Related: <a href="Object.html#method-i-hash"><code>Object#hash</code></a>.</p>

                              <div class="method-source-code" id="hash-source">
            <pre>static VALUE
time_hash(VALUE time)
{
    struct time_object *tobj;

    GetTimeval(time, tobj);
    return rb_hash(w2v(tobj-&gt;timew));
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-hour" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          hour &rarr; integer
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the integer hour of the day for <code>self</code>, in range (0..23):</p>

<pre class="ruby"><span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">2</span>, <span class="ruby-value">3</span>, <span class="ruby-value">4</span>, <span class="ruby-value">5</span>, <span class="ruby-value">6</span>)
<span class="ruby-comment"># =&gt; 2000-01-02 03:04:05 +000006</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">hour</span> <span class="ruby-comment"># =&gt; 3</span>
</pre>

<p>Related: <a href="Time.html#method-i-year"><code>Time#year</code></a>, <a href="Time.html#method-i-mon"><code>Time#mon</code></a>, <a href="Time.html#method-i-min"><code>Time#min</code></a>.</p>

                              <div class="method-source-code" id="hour-source">
            <pre>static VALUE
time_hour(VALUE time)
{
    struct time_object *tobj;

    GetTimeval(time, tobj);
    MAKE_TM(time, tobj);
    return INT2FIX(tobj-&gt;vtm.hour);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-inspect" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          inspect &rarr; string
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns a string representation of <code>self</code> with subseconds:</p>

<pre class="ruby"><span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">12</span>, <span class="ruby-value">31</span>, <span class="ruby-value">23</span>, <span class="ruby-value">59</span>, <span class="ruby-value">59</span>, <span class="ruby-value">0.5</span>)
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">inspect</span> <span class="ruby-comment"># =&gt; &quot;2000-12-31 23:59:59.5 +000001&quot;</span>
</pre>

<p>Related: <a href="Time.html#method-i-ctime"><code>Time#ctime</code></a>, <a href="Time.html#method-i-to_s"><code>Time#to_s</code></a>:</p>

<pre class="ruby"><span class="ruby-identifier">t</span>.<span class="ruby-identifier">ctime</span>   <span class="ruby-comment"># =&gt; &quot;Sun Dec 31 23:59:59 2000&quot;</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">to_s</span>    <span class="ruby-comment"># =&gt; &quot;2000-12-31 23:59:59 +0000&quot;</span>
</pre>

                              <div class="method-source-code" id="inspect-source">
            <pre>static VALUE
time_inspect(VALUE time)
{
    struct time_object *tobj;
    VALUE str, subsec;

    GetTimeval(time, tobj);
    str = strftimev(&quot;%Y-%m-%d %H:%M:%S&quot;, time, rb_usascii_encoding());
    subsec = w2v(wmod(tobj-&gt;timew, WINT2FIXWV(TIME_SCALE)));
    if (subsec == INT2FIX(0)) {
    }
    else if (FIXNUM_P(subsec) &amp;&amp; FIX2LONG(subsec) &lt; TIME_SCALE) {
        long len;
        rb_str_catf(str, &quot;.%09ld&quot;, FIX2LONG(subsec));
        for (len=RSTRING_LEN(str); RSTRING_PTR(str)[len-1] == &#39;0&#39; &amp;&amp; len &gt; 0; len--)
            ;
        rb_str_resize(str, len);
    }
    else {
        rb_str_cat_cstr(str, &quot; &quot;);
        subsec = quov(subsec, INT2FIX(TIME_SCALE));
        rb_str_concat(str, rb_obj_as_string(subsec));
    }
    if (TZMODE_UTC_P(tobj)) {
        rb_str_cat_cstr(str, &quot; UTC&quot;);
    }
    else {
        /* ?TODO: subsecond offset */
        long off = NUM2LONG(rb_funcall(tobj-&gt;vtm.utc_offset, rb_intern(&quot;round&quot;), 0));
        char sign = (off &lt; 0) ? (off = -off, &#39;-&#39;) : &#39;+&#39;;
        int sec = off % 60;
        int min = (off /= 60) % 60;
        off /= 60;
        rb_str_catf(str, &quot; %c%.2d%.2d&quot;, sign, (int)off, min);
        if (sec) rb_str_catf(str, &quot;%.2d&quot;, sec);
    }
    return str;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-isdst" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">isdst</span><span
                                class="method-args">  -&gt; true or false</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns <code>true</code> if <code>self</code> is in daylight saving time, <code>false</code> otherwise:</p>

<pre class="ruby"><span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">local</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>) <span class="ruby-comment"># =&gt; 2000-01-01 00:00:00 -0600</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">zone</span>                     <span class="ruby-comment"># =&gt; &quot;Central Standard Time&quot;</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">dst?</span>                     <span class="ruby-comment"># =&gt; false</span>
<span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">local</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">7</span>, <span class="ruby-value">1</span>) <span class="ruby-comment"># =&gt; 2000-07-01 00:00:00 -0500</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">zone</span>                     <span class="ruby-comment"># =&gt; &quot;Central Daylight Time&quot;</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">dst?</span>                     <span class="ruby-comment"># =&gt; true</span>
</pre>

                              <div class="method-source-code" id="isdst-source">
            <pre>static VALUE
time_isdst(VALUE time)
{
    struct time_object *tobj;

    GetTimeval(time, tobj);
    MAKE_TM(time, tobj);
    if (tobj-&gt;vtm.isdst == VTM_ISDST_INITVAL) {
        rb_raise(rb_eRuntimeError, &quot;isdst is not set yet&quot;);
    }
    return RBOOL(tobj-&gt;vtm.isdst);
}</pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="Time.html#method-i-dst-3F">dst?</a>
                            </div>

                          </div>

                  <div id="method-i-localtime" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          localtime &rarr; self or new_time
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>
                      <div class="method-heading">
                        <span class="method-callseq">
                          localtime(zone) &rarr; new_time
                              </span>
                            </div>

                            <div class="method-description">
                              <p>With no argument given:</p>
<ul><li>
<p>Returns <code>self</code> if <code>self</code> is a local time.</p>
</li><li>
<p>Otherwise returns a new Time in the user’s local timezone:</p>

<pre class="ruby"><span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">20</span>, <span class="ruby-value">15</span>, <span class="ruby-value">1</span>) <span class="ruby-comment"># =&gt; 2000-01-01 20:15:01 UTC</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">localtime</span>                         <span class="ruby-comment"># =&gt; 2000-01-01 14:15:01 -0600</span>
</pre>
</li></ul>

<p>With argument <code>zone</code> given, returns the new Time object created by converting <code>self</code> to the given time zone:</p>

<pre class="ruby"><span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">20</span>, <span class="ruby-value">15</span>, <span class="ruby-value">1</span>) <span class="ruby-comment"># =&gt; 2000-01-01 20:15:01 UTC</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">localtime</span>(<span class="ruby-string">&quot;-09:00&quot;</span>)               <span class="ruby-comment"># =&gt; 2000-01-01 11:15:01 -0900</span>
</pre>

<p>For forms of argument <code>zone</code>, see <a href="timezones_rdoc.html">Timezone Specifiers</a>.</p>

                              <div class="method-source-code" id="localtime-source">
            <pre>static VALUE
time_localtime_m(int argc, VALUE *argv, VALUE time)
{
    VALUE off;

    if (rb_check_arity(argc, 0, 1) &amp;&amp; !NIL_P(off = argv[0])) {
        return time_zonelocal(time, off);
    }

    return time_localtime(time);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-mday" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">mday</span><span
                                class="method-args"> -&gt; integer</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the integer day of the month for <code>self</code>, in range (1..31):</p>

<pre class="ruby"><span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">2</span>, <span class="ruby-value">3</span>, <span class="ruby-value">4</span>, <span class="ruby-value">5</span>, <span class="ruby-value">6</span>)
<span class="ruby-comment"># =&gt; 2000-01-02 03:04:05 +000006</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">mday</span> <span class="ruby-comment"># =&gt; 2</span>
</pre>

<p>Related: <a href="Time.html#method-i-year"><code>Time#year</code></a>, <a href="Time.html#method-i-hour"><code>Time#hour</code></a>, <a href="Time.html#method-i-min"><code>Time#min</code></a>.</p>

                              <div class="method-source-code" id="mday-source">
            <pre>static VALUE
time_mday(VALUE time)
{
    struct time_object *tobj;

    GetTimeval(time, tobj);
    MAKE_TM(time, tobj);
    return INT2FIX(tobj-&gt;vtm.mday);
}</pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="Time.html#method-i-day">day</a>
                            </div>

                          </div>

                  <div id="method-i-min" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          min &rarr; integer
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the integer minute of the hour for <code>self</code>, in range (0..59):</p>

<pre class="ruby"><span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">2</span>, <span class="ruby-value">3</span>, <span class="ruby-value">4</span>, <span class="ruby-value">5</span>, <span class="ruby-value">6</span>)
<span class="ruby-comment"># =&gt; 2000-01-02 03:04:05 +000006</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">min</span> <span class="ruby-comment"># =&gt; 4</span>
</pre>

<p>Related: <a href="Time.html#method-i-year"><code>Time#year</code></a>, <a href="Time.html#method-i-mon"><code>Time#mon</code></a>, <a href="Time.html#method-i-sec"><code>Time#sec</code></a>.</p>

                              <div class="method-source-code" id="min-source">
            <pre>static VALUE
time_min(VALUE time)
{
    struct time_object *tobj;

    GetTimeval(time, tobj);
    MAKE_TM(time, tobj);
    return INT2FIX(tobj-&gt;vtm.min);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-mon" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          mon &rarr; integer
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the integer month of the year for <code>self</code>, in range (1..12):</p>

<pre class="ruby"><span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">2</span>, <span class="ruby-value">3</span>, <span class="ruby-value">4</span>, <span class="ruby-value">5</span>, <span class="ruby-value">6</span>)
<span class="ruby-comment"># =&gt; 2000-01-02 03:04:05 +000006</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">mon</span> <span class="ruby-comment"># =&gt; 1</span>
</pre>

<p>Related: <a href="Time.html#method-i-year"><code>Time#year</code></a>, <a href="Time.html#method-i-hour"><code>Time#hour</code></a>, <a href="Time.html#method-i-min"><code>Time#min</code></a>.</p>

                              <div class="method-source-code" id="mon-source">
            <pre>static VALUE
time_mon(VALUE time)
{
    struct time_object *tobj;

    GetTimeval(time, tobj);
    MAKE_TM(time, tobj);
    return INT2FIX(tobj-&gt;vtm.mon);
}</pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="Time.html#method-i-month">month</a>
                            </div>

                          </div>

                  <div id="method-i-monday-3F" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          monday? &rarr; true or false
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns <code>true</code> if <code>self</code> represents a Monday, <code>false</code> otherwise:</p>

<pre class="ruby"><span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">3</span>) <span class="ruby-comment"># =&gt; 2000-01-03 00:00:00 UTC</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">monday?</span>                <span class="ruby-comment"># =&gt; true</span>
</pre>

<p>Related: <a href="Time.html#method-i-tuesday-3F"><code>Time#tuesday?</code></a>, <a href="Time.html#method-i-wednesday-3F"><code>Time#wednesday?</code></a>, <a href="Time.html#method-i-thursday-3F"><code>Time#thursday?</code></a>.</p>

                              <div class="method-source-code" id="monday-3F-source">
            <pre>static VALUE
time_monday(VALUE time)
{
    wday_p(1);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-month" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">month</span><span
                                class="method-args">()</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the integer month of the year for <code>self</code>, in range (1..12):</p>

<pre class="ruby"><span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">2</span>, <span class="ruby-value">3</span>, <span class="ruby-value">4</span>, <span class="ruby-value">5</span>, <span class="ruby-value">6</span>)
<span class="ruby-comment"># =&gt; 2000-01-02 03:04:05 +000006</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">mon</span> <span class="ruby-comment"># =&gt; 1</span>
</pre>

<p>Related: <a href="Time.html#method-i-year"><code>Time#year</code></a>, <a href="Time.html#method-i-hour"><code>Time#hour</code></a>, <a href="Time.html#method-i-min"><code>Time#min</code></a>.</p>

                            </div>


                            <div class="aliases">
                              Alias for: <a href="Time.html#method-i-mon">mon</a>
                            </div>
                          </div>

                  <div id="method-i-nsec" class="method-detail method-alias">
                      <div class="method-heading">
                        <span class="method-callseq">
                          nsec &rarr; integer
                              </span>
                            </div>

                            <div class="method-description">
                              <p>Returns the number of nanoseconds in the subseconds part of <code>self</code> in the range (0..999_999_999); lower-order digits are truncated, not rounded:</p>

<pre class="ruby"><span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span> <span class="ruby-comment"># =&gt; 2022-07-11 15:04:53.3219637 -0500</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">nsec</span>       <span class="ruby-comment"># =&gt; 321963700</span>
</pre>

<p>Related: <a href="Time.html#method-i-subsec"><code>Time#subsec</code></a> (returns exact subseconds).</p>

                            </div>


                            <div class="aliases">
                              Alias for: <a href="Time.html#method-i-tv_nsec">tv_nsec</a>
                            </div>
                          </div>

                  <div id="method-i-round" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          round(ndigits = 0) &rarr; new_time
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns a new Time object whose numeric value is that of <code>self</code>, with its seconds value rounded to precision <code>ndigits</code>:</p>

<pre class="ruby"><span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2010</span>, <span class="ruby-value">3</span>, <span class="ruby-value">30</span>, <span class="ruby-value">5</span>, <span class="ruby-value">43</span>, <span class="ruby-value">25.123456789r</span>)
<span class="ruby-identifier">t</span>          <span class="ruby-comment"># =&gt; 2010-03-30 05:43:25.123456789 UTC</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">round</span>    <span class="ruby-comment"># =&gt; 2010-03-30 05:43:25 UTC</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">round</span>(<span class="ruby-value">0</span>) <span class="ruby-comment"># =&gt; 2010-03-30 05:43:25 UTC</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">round</span>(<span class="ruby-value">1</span>) <span class="ruby-comment"># =&gt; 2010-03-30 05:43:25.1 UTC</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">round</span>(<span class="ruby-value">2</span>) <span class="ruby-comment"># =&gt; 2010-03-30 05:43:25.12 UTC</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">round</span>(<span class="ruby-value">3</span>) <span class="ruby-comment"># =&gt; 2010-03-30 05:43:25.123 UTC</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">round</span>(<span class="ruby-value">4</span>) <span class="ruby-comment"># =&gt; 2010-03-30 05:43:25.1235 UTC</span>

<span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">1999</span>, <span class="ruby-value">12</span>,<span class="ruby-value">31</span>, <span class="ruby-value">23</span>, <span class="ruby-value">59</span>, <span class="ruby-value">59</span>)
<span class="ruby-identifier">t</span>                <span class="ruby-comment"># =&gt; 1999-12-31 23:59:59 UTC</span>
(<span class="ruby-identifier">t</span> <span class="ruby-operator">+</span> <span class="ruby-value">0.4</span>).<span class="ruby-identifier">round</span>  <span class="ruby-comment"># =&gt; 1999-12-31 23:59:59 UTC</span>
(<span class="ruby-identifier">t</span> <span class="ruby-operator">+</span> <span class="ruby-value">0.49</span>).<span class="ruby-identifier">round</span> <span class="ruby-comment"># =&gt; 1999-12-31 23:59:59 UTC</span>
(<span class="ruby-identifier">t</span> <span class="ruby-operator">+</span> <span class="ruby-value">0.5</span>).<span class="ruby-identifier">round</span>  <span class="ruby-comment"># =&gt; 2000-01-01 00:00:00 UTC</span>
(<span class="ruby-identifier">t</span> <span class="ruby-operator">+</span> <span class="ruby-value">1.4</span>).<span class="ruby-identifier">round</span>  <span class="ruby-comment"># =&gt; 2000-01-01 00:00:00 UTC</span>
(<span class="ruby-identifier">t</span> <span class="ruby-operator">+</span> <span class="ruby-value">1.49</span>).<span class="ruby-identifier">round</span> <span class="ruby-comment"># =&gt; 2000-01-01 00:00:00 UTC</span>
(<span class="ruby-identifier">t</span> <span class="ruby-operator">+</span> <span class="ruby-value">1.5</span>).<span class="ruby-identifier">round</span>  <span class="ruby-comment"># =&gt; 2000-01-01 00:00:01 UTC</span>
</pre>

<p>Related: <a href="Time.html#method-i-ceil"><code>Time#ceil</code></a>, <a href="Time.html#method-i-floor"><code>Time#floor</code></a>.</p>

                              <div class="method-source-code" id="round-source">
            <pre>static VALUE
time_round(int argc, VALUE *argv, VALUE time)
{
    VALUE ndigits, v, den;
    struct time_object *tobj;

    if (!rb_check_arity(argc, 0, 1) || NIL_P(ndigits = argv[0]))
        den = INT2FIX(1);
    else
        den = ndigits_denominator(ndigits);

    GetTimeval(time, tobj);
    v = w2v(rb_time_unmagnify(tobj-&gt;timew));

    v = modv(v, den);
    if (lt(v, quov(den, INT2FIX(2))))
        return time_add(tobj, time, v, -1);
    else
        return time_add(tobj, time, subv(den, v), 1);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-saturday-3F" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          saturday? &rarr; true or false
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns <code>true</code> if <code>self</code> represents a Saturday, <code>false</code> otherwise:</p>

<pre class="ruby"><span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>) <span class="ruby-comment"># =&gt; 2000-01-01 00:00:00 UTC</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">saturday?</span>              <span class="ruby-comment"># =&gt; true</span>
</pre>

<p>Related: <a href="Time.html#method-i-sunday-3F"><code>Time#sunday?</code></a>, <a href="Time.html#method-i-monday-3F"><code>Time#monday?</code></a>, <a href="Time.html#method-i-tuesday-3F"><code>Time#tuesday?</code></a>.</p>

                              <div class="method-source-code" id="saturday-3F-source">
            <pre>static VALUE
time_saturday(VALUE time)
{
    wday_p(6);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-sec" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          sec &rarr; integer
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the integer second of the minute for <code>self</code>, in range (0..60):</p>

<pre class="ruby"><span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">2</span>, <span class="ruby-value">3</span>, <span class="ruby-value">4</span>, <span class="ruby-value">5</span>, <span class="ruby-value">6</span>)
<span class="ruby-comment"># =&gt; 2000-01-02 03:04:05 +000006</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">sec</span> <span class="ruby-comment"># =&gt; 5</span>
</pre>

<p>Note: the second value may be 60 when there is a <a href="https://en.wikipedia.org/wiki/Leap_second">leap second</a>.</p>

<p>Related: <a href="Time.html#method-i-year"><code>Time#year</code></a>, <a href="Time.html#method-i-mon"><code>Time#mon</code></a>, <a href="Time.html#method-i-min"><code>Time#min</code></a>.</p>

                              <div class="method-source-code" id="sec-source">
            <pre>static VALUE
time_sec(VALUE time)
{
    struct time_object *tobj;

    GetTimeval(time, tobj);
    MAKE_TM(time, tobj);
    return INT2FIX(tobj-&gt;vtm.sec);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-strftime" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          strftime(format_string) &rarr; string
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns a string representation of <code>self</code>, formatted according to the given string <code>format</code>. See <a href="strftime_formatting_rdoc.html">Formats for Dates and Times</a>.</p>

                              <div class="method-source-code" id="strftime-source">
            <pre>static VALUE
time_strftime(VALUE time, VALUE format)
{
    struct time_object *tobj;
    const char *fmt;
    long len;
    rb_encoding *enc;
    VALUE tmp;

    GetTimeval(time, tobj);
    MAKE_TM_ENSURE(time, tobj, tobj-&gt;vtm.yday != 0);
    StringValue(format);
    if (!rb_enc_str_asciicompat_p(format)) {
        rb_raise(rb_eArgError, &quot;format should have ASCII compatible encoding&quot;);
    }
    tmp = rb_str_tmp_frozen_acquire(format);
    fmt = RSTRING_PTR(tmp);
    len = RSTRING_LEN(tmp);
    enc = rb_enc_get(format);
    if (len == 0) {
        rb_warning(&quot;strftime called with empty format string&quot;);
        return rb_enc_str_new(0, 0, enc);
    }
    else {
        VALUE str = rb_strftime_alloc(fmt, len, enc, time, &amp;tobj-&gt;vtm, tobj-&gt;timew,
                                      TZMODE_UTC_P(tobj));
        rb_str_tmp_frozen_release(format, tmp);
        if (!str) rb_raise(rb_eArgError, &quot;invalid format: %&quot;PRIsVALUE, format);
        return str;
    }
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-subsec" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          subsec &rarr; numeric
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the exact subseconds for <code>self</code> as a <a href="Numeric.html"><code>Numeric</code></a> (<a href="Integer.html"><code>Integer</code></a> or <a href="Rational.html"><code>Rational</code></a>):</p>

<pre class="ruby"><span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span> <span class="ruby-comment"># =&gt; 2022-07-11 15:11:36.8490302 -0500</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">subsec</span>     <span class="ruby-comment"># =&gt; (4245151/5000000)</span>
</pre>

<p>If the subseconds is zero, returns integer zero:</p>

<pre class="ruby"><span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">2</span>, <span class="ruby-value">3</span>, <span class="ruby-value">4</span>) <span class="ruby-comment"># =&gt; 2000-01-01 02:03:04 -0600</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">subsec</span>                          <span class="ruby-comment"># =&gt; 0</span>
</pre>

                              <div class="method-source-code" id="subsec-source">
            <pre>static VALUE
time_subsec(VALUE time)
{
    struct time_object *tobj;

    GetTimeval(time, tobj);
    return quov(w2v(wmod(tobj-&gt;timew, WINT2FIXWV(TIME_SCALE))), INT2FIX(TIME_SCALE));
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-sunday-3F" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          sunday? &rarr; true or false
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns <code>true</code> if <code>self</code> represents a Sunday, <code>false</code> otherwise:</p>

<pre class="ruby"><span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">2</span>) <span class="ruby-comment"># =&gt; 2000-01-02 00:00:00 UTC</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">sunday?</span>                <span class="ruby-comment"># =&gt; true</span>
</pre>

<p>Related: <a href="Time.html#method-i-monday-3F"><code>Time#monday?</code></a>, <a href="Time.html#method-i-tuesday-3F"><code>Time#tuesday?</code></a>, <a href="Time.html#method-i-wednesday-3F"><code>Time#wednesday?</code></a>.</p>

                              <div class="method-source-code" id="sunday-3F-source">
            <pre>static VALUE
time_sunday(VALUE time)
{
    wday_p(0);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-thursday-3F" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          thursday? &rarr; true or false
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns <code>true</code> if <code>self</code> represents a Thursday, <code>false</code> otherwise:</p>

<pre class="ruby"><span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">6</span>) <span class="ruby-comment"># =&gt; 2000-01-06 00:00:00 UTC</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">thursday?</span>              <span class="ruby-comment"># =&gt; true</span>
</pre>

<p>Related: <a href="Time.html#method-i-friday-3F"><code>Time#friday?</code></a>, <a href="Time.html#method-i-saturday-3F"><code>Time#saturday?</code></a>, <a href="Time.html#method-i-sunday-3F"><code>Time#sunday?</code></a>.</p>

                              <div class="method-source-code" id="thursday-3F-source">
            <pre>static VALUE
time_thursday(VALUE time)
{
    wday_p(4);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-to_a" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          to_a &rarr; array
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns a 10-element array of values representing <code>self</code>:</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>).<span class="ruby-identifier">to_a</span>
<span class="ruby-comment"># =&gt; [0,   0,   0,    1,   1,   2000, 6,    1,    false, &quot;UTC&quot;]</span>
<span class="ruby-comment">#    [sec, min, hour, day, mon, year, wday, yday, dst?,   zone]</span>
</pre>

<p>The returned array is suitable for use as an argument to <a href="Time.html#method-c-utc"><code>Time.utc</code></a> or <a href="Time.html#method-c-local"><code>Time.local</code></a> to create a new Time object.</p>

                              <div class="method-source-code" id="to_a-source">
            <pre>static VALUE
time_to_a(VALUE time)
{
    struct time_object *tobj;

    GetTimeval(time, tobj);
    MAKE_TM_ENSURE(time, tobj, tobj-&gt;vtm.yday != 0);
    return rb_ary_new3(10,
                    INT2FIX(tobj-&gt;vtm.sec),
                    INT2FIX(tobj-&gt;vtm.min),
                    INT2FIX(tobj-&gt;vtm.hour),
                    INT2FIX(tobj-&gt;vtm.mday),
                    INT2FIX(tobj-&gt;vtm.mon),
                    tobj-&gt;vtm.year,
                    INT2FIX(tobj-&gt;vtm.wday),
                    INT2FIX(tobj-&gt;vtm.yday),
                    RBOOL(tobj-&gt;vtm.isdst),
                    time_zone(time));
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-to_f" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          to_f &rarr; float
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the value of <code>self</code> as a <a href="Float.html"><code>Float</code></a> number <a href="Time.html#class-Time-label-Epoch+Seconds">Epoch seconds</a>; subseconds are included.</p>

<p>The stored value of <code>self</code> is a <a href="Rational.html#class-Rational-label-#method-i-to_f">Rational</a>, which means that the returned value may be approximate:</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">1970</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>).<span class="ruby-identifier">to_f</span>         <span class="ruby-comment"># =&gt; 0.0</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">1970</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">999999</span>).<span class="ruby-identifier">to_f</span> <span class="ruby-comment"># =&gt; 0.999999</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">1950</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>).<span class="ruby-identifier">to_f</span>         <span class="ruby-comment"># =&gt; -631152000.0</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">1990</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>).<span class="ruby-identifier">to_f</span>         <span class="ruby-comment"># =&gt; 631152000.0</span>
</pre>

<p>Related: <a href="Time.html#method-i-to_i"><code>Time#to_i</code></a>, <a href="Time.html#method-i-to_r"><code>Time#to_r</code></a>.</p>

                              <div class="method-source-code" id="to_f-source">
            <pre>static VALUE
time_to_f(VALUE time)
{
    struct time_object *tobj;

    GetTimeval(time, tobj);
    return rb_Float(rb_time_unmagnify_to_float(tobj-&gt;timew));
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-to_i" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          to_i &rarr; integer
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the value of <code>self</code> as integer <a href="Time.html#class-Time-label-Epoch+Seconds">Epoch seconds</a>; subseconds are truncated (not rounded):</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">1970</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>).<span class="ruby-identifier">to_i</span>         <span class="ruby-comment"># =&gt; 0</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">1970</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">999999</span>).<span class="ruby-identifier">to_i</span> <span class="ruby-comment"># =&gt; 0</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">1950</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>).<span class="ruby-identifier">to_i</span>         <span class="ruby-comment"># =&gt; -631152000</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">1990</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>).<span class="ruby-identifier">to_i</span>         <span class="ruby-comment"># =&gt; 631152000</span>
</pre>

<p>Related: <a href="Time.html#method-i-to_f"><code>Time#to_f</code></a> <a href="Time.html#method-i-to_r"><code>Time#to_r</code></a>.</p>

                              <div class="method-source-code" id="to_i-source">
            <pre>static VALUE
time_to_i(VALUE time)
{
    struct time_object *tobj;

    GetTimeval(time, tobj);
    return w2v(wdiv(tobj-&gt;timew, WINT2FIXWV(TIME_SCALE)));
}</pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="Time.html#method-i-tv_sec">tv_sec</a>
                            </div>

                          </div>

                  <div id="method-i-to_r" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          to_r &rarr; rational
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the value of <code>self</code> as a <a href="Rational.html"><code>Rational</code></a> exact number of <a href="Time.html#class-Time-label-Epoch+Seconds">Epoch seconds</a>;</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>.<span class="ruby-identifier">to_r</span> <span class="ruby-comment"># =&gt; (16571402750320203/10000000)</span>
</pre>

<p>Related: <a href="Time.html#method-i-to_f"><code>Time#to_f</code></a>, <a href="Time.html#method-i-to_i"><code>Time#to_i</code></a>.</p>

                              <div class="method-source-code" id="to_r-source">
            <pre>static VALUE
time_to_r(VALUE time)
{
    struct time_object *tobj;
    VALUE v;

    GetTimeval(time, tobj);
    v = rb_time_unmagnify_to_rational(tobj-&gt;timew);
    if (!RB_TYPE_P(v, T_RATIONAL)) {
        v = rb_Rational1(v);
    }
    return v;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-to_s" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          to_s    &rarr; string
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns a string representation of <code>self</code>, without subseconds:</p>

<pre class="ruby"><span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">12</span>, <span class="ruby-value">31</span>, <span class="ruby-value">23</span>, <span class="ruby-value">59</span>, <span class="ruby-value">59</span>, <span class="ruby-value">0.5</span>)
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">to_s</span>    <span class="ruby-comment"># =&gt; &quot;2000-12-31 23:59:59 +0000&quot;</span>
</pre>

<p>Related: <a href="Time.html#method-i-ctime"><code>Time#ctime</code></a>, <a href="Time.html#method-i-inspect"><code>Time#inspect</code></a>:</p>

<pre class="ruby"><span class="ruby-identifier">t</span>.<span class="ruby-identifier">ctime</span>   <span class="ruby-comment"># =&gt; &quot;Sun Dec 31 23:59:59 2000&quot;</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">inspect</span> <span class="ruby-comment"># =&gt; &quot;2000-12-31 23:59:59.5 +000001&quot;</span>
</pre>

                              <div class="method-source-code" id="to_s-source">
            <pre>static VALUE
time_to_s(VALUE time)
{
    struct time_object *tobj;

    GetTimeval(time, tobj);
    if (TZMODE_UTC_P(tobj))
        return strftimev(&quot;%Y-%m-%d %H:%M:%S UTC&quot;, time, rb_usascii_encoding());
    else
        return strftimev(&quot;%Y-%m-%d %H:%M:%S %z&quot;, time, rb_usascii_encoding());
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-tuesday-3F" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          tuesday? &rarr; true or false
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns <code>true</code> if <code>self</code> represents a Tuesday, <code>false</code> otherwise:</p>

<pre class="ruby"><span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">4</span>) <span class="ruby-comment"># =&gt; 2000-01-04 00:00:00 UTC</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">tuesday?</span>               <span class="ruby-comment"># =&gt; true</span>
</pre>

<p>Related: <a href="Time.html#method-i-wednesday-3F"><code>Time#wednesday?</code></a>, <a href="Time.html#method-i-thursday-3F"><code>Time#thursday?</code></a>, <a href="Time.html#method-i-friday-3F"><code>Time#friday?</code></a>.</p>

                              <div class="method-source-code" id="tuesday-3F-source">
            <pre>static VALUE
time_tuesday(VALUE time)
{
    wday_p(2);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-tv_nsec" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">tv_nsec</span><span
                                class="method-args"> -&gt; integer</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the number of nanoseconds in the subseconds part of <code>self</code> in the range (0..999_999_999); lower-order digits are truncated, not rounded:</p>

<pre class="ruby"><span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span> <span class="ruby-comment"># =&gt; 2022-07-11 15:04:53.3219637 -0500</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">nsec</span>       <span class="ruby-comment"># =&gt; 321963700</span>
</pre>

<p>Related: <a href="Time.html#method-i-subsec"><code>Time#subsec</code></a> (returns exact subseconds).</p>

                              <div class="method-source-code" id="tv_nsec-source">
            <pre>static VALUE
time_nsec(VALUE time)
{
    struct time_object *tobj;

    GetTimeval(time, tobj);
    return rb_to_int(w2v(wmulquoll(wmod(tobj-&gt;timew, WINT2WV(TIME_SCALE)), 1000000000, TIME_SCALE)));
}</pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="Time.html#method-i-nsec">nsec</a>
                            </div>

                          </div>

                  <div id="method-i-tv_sec" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">tv_sec</span><span
                                class="method-args">()</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the value of <code>self</code> as integer <a href="Time.html#class-Time-label-Epoch+Seconds">Epoch seconds</a>; subseconds are truncated (not rounded):</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">1970</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>).<span class="ruby-identifier">to_i</span>         <span class="ruby-comment"># =&gt; 0</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">1970</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">999999</span>).<span class="ruby-identifier">to_i</span> <span class="ruby-comment"># =&gt; 0</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">1950</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>).<span class="ruby-identifier">to_i</span>         <span class="ruby-comment"># =&gt; -631152000</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">1990</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>).<span class="ruby-identifier">to_i</span>         <span class="ruby-comment"># =&gt; 631152000</span>
</pre>

<p>Related: <a href="Time.html#method-i-to_f"><code>Time#to_f</code></a> <a href="Time.html#method-i-to_r"><code>Time#to_r</code></a>.</p>

                            </div>


                            <div class="aliases">
                              Alias for: <a href="Time.html#method-i-to_i">to_i</a>
                            </div>
                          </div>

                  <div id="method-i-tv_usec" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">tv_usec</span><span
                                class="method-args"> -&gt; integer</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the number of microseconds in the subseconds part of <code>self</code> in the range (0..999_999); lower-order digits are truncated, not rounded:</p>

<pre class="ruby"><span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span> <span class="ruby-comment"># =&gt; 2022-07-11 14:59:47.5484697 -0500</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">usec</span>       <span class="ruby-comment"># =&gt; 548469</span>
</pre>

<p>Related: <a href="Time.html#method-i-subsec"><code>Time#subsec</code></a> (returns exact subseconds).</p>

                              <div class="method-source-code" id="tv_usec-source">
            <pre>static VALUE
time_usec(VALUE time)
{
    struct time_object *tobj;
    wideval_t w, q, r;

    GetTimeval(time, tobj);

    w = wmod(tobj-&gt;timew, WINT2WV(TIME_SCALE));
    wmuldivmod(w, WINT2FIXWV(1000000), WINT2FIXWV(TIME_SCALE), &amp;q, &amp;r);
    return rb_to_int(w2v(q));
}</pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="Time.html#method-i-usec">usec</a>
                            </div>

                          </div>

                  <div id="method-i-usec" class="method-detail method-alias">
                      <div class="method-heading">
                        <span class="method-callseq">
                          usec &rarr; integer
                              </span>
                            </div>

                            <div class="method-description">
                              <p>Returns the number of microseconds in the subseconds part of <code>self</code> in the range (0..999_999); lower-order digits are truncated, not rounded:</p>

<pre class="ruby"><span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span> <span class="ruby-comment"># =&gt; 2022-07-11 14:59:47.5484697 -0500</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">usec</span>       <span class="ruby-comment"># =&gt; 548469</span>
</pre>

<p>Related: <a href="Time.html#method-i-subsec"><code>Time#subsec</code></a> (returns exact subseconds).</p>

                            </div>


                            <div class="aliases">
                              Alias for: <a href="Time.html#method-i-tv_usec">tv_usec</a>
                            </div>
                          </div>

                  <div id="method-i-utc" class="method-detail method-alias">
                      <div class="method-heading">
                        <span class="method-callseq">
                          utc &rarr; self
                              </span>
                            </div>

                            <div class="method-description">
                              <p>Returns <code>self</code>, converted to the UTC timezone:</p>

<pre class="ruby"><span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>) <span class="ruby-comment"># =&gt; 2000-01-01 00:00:00 -0600</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">utc?</span>             <span class="ruby-comment"># =&gt; false</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">utc</span>              <span class="ruby-comment"># =&gt; 2000-01-01 06:00:00 UTC</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">utc?</span>             <span class="ruby-comment"># =&gt; true</span>
</pre>

<p>Related: <a href="Time.html#method-i-getutc"><code>Time#getutc</code></a> (returns a new converted Time object).</p>

                            </div>


                            <div class="aliases">
                              Alias for: <a href="Time.html#method-i-gmtime">gmtime</a>
                            </div>
                          </div>

                  <div id="method-i-utc-3F" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          utc? &rarr; true or false
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns <code>true</code> if <code>self</code> represents a time in UTC (GMT):</p>

<pre class="ruby"><span class="ruby-identifier">now</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
<span class="ruby-comment"># =&gt; 2022-08-18 10:24:13.5398485 -0500</span>
<span class="ruby-identifier">now</span>.<span class="ruby-identifier">utc?</span> <span class="ruby-comment"># =&gt; false</span>
<span class="ruby-identifier">utc</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>, <span class="ruby-value">20</span>, <span class="ruby-value">15</span>, <span class="ruby-value">1</span>)
<span class="ruby-comment"># =&gt; 2000-01-01 20:15:01 UTC</span>
<span class="ruby-identifier">utc</span>.<span class="ruby-identifier">utc?</span> <span class="ruby-comment"># =&gt; true</span>
</pre>

<p>Related: <a href="Time.html#method-c-utc"><code>Time.utc</code></a>.</p>

                              <div class="method-source-code" id="utc-3F-source">
            <pre>static VALUE
time_utc_p(VALUE time)
{
    struct time_object *tobj;

    GetTimeval(time, tobj);
    return RBOOL(TZMODE_UTC_P(tobj));
}</pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="Time.html#method-i-gmt-3F">gmt?</a>
                            </div>

                          </div>

                  <div id="method-i-utc_offset" class="method-detail method-alias">
                      <div class="method-heading">
                        <span class="method-callseq">
                          utc_offset &rarr; integer
                              </span>
                            </div>

                            <div class="method-description">
                              <p>Returns the offset in seconds between the timezones of UTC and <code>self</code>:</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>).<span class="ruby-identifier">utc_offset</span>   <span class="ruby-comment"># =&gt; 0</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">local</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>).<span class="ruby-identifier">utc_offset</span> <span class="ruby-comment"># =&gt; -21600 # -6*3600, or minus six hours.</span>
</pre>

                            </div>


                            <div class="aliases">
                              Alias for: <a href="Time.html#method-i-gmtoff">gmtoff</a>
                            </div>
                          </div>

                  <div id="method-i-wday" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          wday &rarr; integer
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the integer day of the week for <code>self</code>, in range (0..6), with Sunday as zero.</p>

<pre class="ruby"><span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">2</span>, <span class="ruby-value">3</span>, <span class="ruby-value">4</span>, <span class="ruby-value">5</span>, <span class="ruby-value">6</span>)
<span class="ruby-comment"># =&gt; 2000-01-02 03:04:05 +000006</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">wday</span>    <span class="ruby-comment"># =&gt; 0</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">sunday?</span> <span class="ruby-comment"># =&gt; true</span>
</pre>

<p>Related: <a href="Time.html#method-i-year"><code>Time#year</code></a>, <a href="Time.html#method-i-hour"><code>Time#hour</code></a>, <a href="Time.html#method-i-min"><code>Time#min</code></a>.</p>

                              <div class="method-source-code" id="wday-source">
            <pre>static VALUE
time_wday(VALUE time)
{
    struct time_object *tobj;

    GetTimeval(time, tobj);
    MAKE_TM_ENSURE(time, tobj, tobj-&gt;vtm.wday != VTM_WDAY_INITVAL);
    return INT2FIX((int)tobj-&gt;vtm.wday);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-wednesday-3F" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          wednesday? &rarr; true or false
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns <code>true</code> if <code>self</code> represents a Wednesday, <code>false</code> otherwise:</p>

<pre class="ruby"><span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">5</span>) <span class="ruby-comment"># =&gt; 2000-01-05 00:00:00 UTC</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">wednesday?</span>             <span class="ruby-comment"># =&gt; true</span>
</pre>

<p>Related: <a href="Time.html#method-i-thursday-3F"><code>Time#thursday?</code></a>, <a href="Time.html#method-i-friday-3F"><code>Time#friday?</code></a>, <a href="Time.html#method-i-saturday-3F"><code>Time#saturday?</code></a>.</p>

                              <div class="method-source-code" id="wednesday-3F-source">
            <pre>static VALUE
time_wednesday(VALUE time)
{
    wday_p(3);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-yday" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          yday &rarr; integer
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the integer day of the year of <code>self</code>, in range (1..366).</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>).<span class="ruby-identifier">yday</span>   <span class="ruby-comment"># =&gt; 1</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">12</span>, <span class="ruby-value">31</span>).<span class="ruby-identifier">yday</span> <span class="ruby-comment"># =&gt; 366</span>
</pre>

                              <div class="method-source-code" id="yday-source">
            <pre>static VALUE
time_yday(VALUE time)
{
    struct time_object *tobj;

    GetTimeval(time, tobj);
    MAKE_TM_ENSURE(time, tobj, tobj-&gt;vtm.yday != 0);
    return INT2FIX(tobj-&gt;vtm.yday);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-year" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          year &rarr; integer
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the integer year for <code>self</code>:</p>

<pre class="ruby"><span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">2</span>, <span class="ruby-value">3</span>, <span class="ruby-value">4</span>, <span class="ruby-value">5</span>, <span class="ruby-value">6</span>)
<span class="ruby-comment"># =&gt; 2000-01-02 03:04:05 +000006</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">year</span> <span class="ruby-comment"># =&gt; 2000</span>
</pre>

<p>Related: <a href="Time.html#method-i-mon"><code>Time#mon</code></a>, <a href="Time.html#method-i-hour"><code>Time#hour</code></a>, <a href="Time.html#method-i-min"><code>Time#min</code></a>.</p>

                              <div class="method-source-code" id="year-source">
            <pre>static VALUE
time_year(VALUE time)
{
    struct time_object *tobj;

    GetTimeval(time, tobj);
    MAKE_TM(time, tobj);
    return tobj-&gt;vtm.year;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-zone" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          zone &rarr; string or timezone
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the string name of the time zone for <code>self</code>:</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>).<span class="ruby-identifier">zone</span> <span class="ruby-comment"># =&gt; &quot;UTC&quot;</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>).<span class="ruby-identifier">zone</span> <span class="ruby-comment"># =&gt; &quot;Central Standard Time&quot;</span>
</pre>

                              <div class="method-source-code" id="zone-source">
            <pre>static VALUE
time_zone(VALUE time)
{
    struct time_object *tobj;
    VALUE zone;

    GetTimeval(time, tobj);
    MAKE_TM(time, tobj);

    if (TZMODE_UTC_P(tobj)) {
        return rb_usascii_str_new_cstr(&quot;UTC&quot;);
    }
    zone = tobj-&gt;vtm.zone;
    if (NIL_P(zone))
        return Qnil;

    if (RB_TYPE_P(zone, T_STRING))
        zone = rb_str_dup(zone);
    return zone;
}</pre>
                              </div>
                            </div>


                          </div>

                          </section>

              </section>
              </main>



            </div>  <!--  class='wrapper hdiv' -->


<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a></p>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.</p>
<p>Based on <a href="https://github.com/ged/darkfish/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>

  
    <p><p><a href="https://ruby-doc.org">Ruby-doc.org</a> is provided by <a href="https://jamesbritt.com">James Britt</a> and <a href="https://neurogami.com">Neurogami</a>. </p><p><a href="https://jamesbritt.bandcamp.com/">Hack your world.  Feed your head.  Live curious</a>.</p>
</p>
  
  </footer>

<script type="text/javascript">


  let ads  = $("#carbonads-container").children().detach();


  function swapMode() {
    var cookieName = 'darkmode';
    var cssDarkmode = Cookies.get(cookieName);
    console.log("***** swapMode! " + cssDarkmode + " *****");


    if (cssDarkmode == "true") {
      console.log("We have dark mode, set the css to light ...");
      $('#rdoccss').attr("href", defaultModeCssHref);
      $('#cssSelect').text("Dark mode");
      cssDarkmode = "false";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    } else {
      console.log("We not have dark mode, set the css to dark ...");
      $('#rdoccss').attr("href", darkModeCsseHref);
      $('#cssSelect').text("Light mode");
      cssDarkmode = "true";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    }

    console.log("  --------------- ");
  }


const vueCssApp = new Vue({
el: '#menubar',
data: {
isDark: false
},
methods: {
toggleClass: function(event){
this.isDark = !this.isDark;
}
}
})

const vueApp = new Vue({
el: '#vapp',
data: { 
isOpen: true
},

mounted() {
this.handleResize();
this.manage_mob_classes();
window.addEventListener('resize', this.handleResize)
//this.isOpen !=  (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},
destroyed() {
window.removeEventListener('resize', this.handleResize)
},
created() {
//manage_mob_classes();
},

methods : {
isMobile() {
  return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},

  handleResize() {
    if (!this.isMobile()) {
      this.isOpen = window.innerWidth > 800;
    }
  },

  manage_mob_classes() {
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
      $("nav").addClass("mob_nav");
      $("main").addClass("mob_main");
      $("#extraz").addClass("mob_extraz");
      $("#carbonads-container").addClass("mob_carbonads-container");
      this.isOpen  = false;
    } else {
      $("nav").removeClass("mob_nav") 
        $("main").removeClass("mob_main");
      $("#extraz").removeClass("mob_extraz");
      $("#carbonads-container").removeClass("mob_carbonads-container");
      this.isOpen  = true;
    }
  },

  toggleNav() {
    this.isOpen =! this.isOpen ;
    // alert("Toggle nav!");
    console.log("toggleNav() click: " + this.isOpen );
  }
}
})

$("#carbonads-container").append(ads);


$(function() {

    var darkmode = Cookies.get("darkmode");
    console.log("Document ready: " + darkmode);

    if ( darkmode  == "true" ) {
      $('#cssSelect').text("Light mode");
    } else {
      $('#cssSelect').text("Dark mode");
     }

    $('body').css('display','block');
    });

</script>

    
  </body> 
</html>

